1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

vue ui i18n: fixed bug: if multiple embedded named strings in localized string must replace ALL (use global regex flag)

This commit is contained in:
Ivan Velev 2022-02-07 18:59:25 -08:00
parent 6e7f0216e1
commit 47ada39b16

View File

@ -27,7 +27,7 @@ export class PywbI18N {
getText(id, embeddedVariableStrings=null) {
const translated = decodeURIComponent(this.config[id] || id);
if (embeddedVariableStrings && id.indexOf('{') >= 0 && id.indexOf('}') >= 0 ) {
return translated.replace(/{(\w+)}/, (match, stringId) => embeddedVariableStrings[stringId]);
return translated.replace(/{(\w+)}/g, (match, stringId) => embeddedVariableStrings[stringId]);
}
return translated
}