make sure to render localized strings with $ in them correctly

pull/2190/head
Audric Ackermann 3 years ago
parent 63e64ac3e8
commit e2f9b3e764
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -17,10 +17,14 @@ exports.setup = (locale, messages) => {
} }
if (Array.isArray(substitutions)) { if (Array.isArray(substitutions)) {
return substitutions.reduce( const replacedNameDollarSign = message.replaceAll('$', 'ᅲ');
(result, substitution) => result.replace(/\$.+?\$/, substitution),
message const substituted = substitutions.reduce(
(result, substitution) => result.replace(/ᅲ.+?ᅲ/, substitution),
replacedNameDollarSign
); );
return substituted.replaceAll('ᅲ', '$');
} else if (substitutions) { } else if (substitutions) {
return message.replace(/\$.+?\$/, substitutions); return message.replace(/\$.+?\$/, substitutions);
} }

Loading…
Cancel
Save