Return original token when missing from translation

pull/5965/head
Bogdan 10 months ago committed by Mark McDowall
parent ce4ac75941
commit 2e9dbfd382

@ -30,9 +30,8 @@ export default function translate(
const translation = translations[key] || key;
if (tokens) {
return translation.replace(
/\{([a-z0-9]+?)\}/gi,
(match, tokenMatch) => String(tokens[tokenMatch]) ?? match
return translation.replace(/\{([a-z0-9]+?)\}/gi, (match, tokenMatch) =>
String(tokens[tokenMatch] ?? match)
);
}

Loading…
Cancel
Save