From e2f9b3e764b6449fb92fccb54485855fb2c413fc Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 7 Mar 2022 09:58:33 +1100 Subject: [PATCH] make sure to render localized strings with $ in them correctly --- js/modules/i18n.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/js/modules/i18n.js b/js/modules/i18n.js index 9cd8ef2d3..5dd495690 100644 --- a/js/modules/i18n.js +++ b/js/modules/i18n.js @@ -17,10 +17,14 @@ exports.setup = (locale, messages) => { } if (Array.isArray(substitutions)) { - return substitutions.reduce( - (result, substitution) => result.replace(/\$.+?\$/, substitution), - message + const replacedNameDollarSign = message.replaceAll('$', 'ᅲ'); + + const substituted = substitutions.reduce( + (result, substitution) => result.replace(/ᅲ.+?ᅲ/, substitution), + replacedNameDollarSign ); + + return substituted.replaceAll('ᅲ', '$'); } else if (substitutions) { return message.replace(/\$.+?\$/, substitutions); }