Return original token when missing from translation
This commit is contained in:
parent
ce4ac75941
commit
2e9dbfd382
|
@ -30,9 +30,8 @@ export default function translate(
|
||||||
const translation = translations[key] || key;
|
const translation = translations[key] || key;
|
||||||
|
|
||||||
if (tokens) {
|
if (tokens) {
|
||||||
return translation.replace(
|
return translation.replace(/\{([a-z0-9]+?)\}/gi, (match, tokenMatch) =>
|
||||||
/\{([a-z0-9]+?)\}/gi,
|
String(tokens[tokenMatch] ?? match)
|
||||||
(match, tokenMatch) => String(tokens[tokenMatch]) ?? match
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue