Translation update, updating inline div tags and placeHolder attributes

This commit is contained in:
nitsua
2020-09-05 14:46:39 -04:00
committed by Qstick
parent 914d8f9937
commit f286f99bb6
53 changed files with 313 additions and 96 deletions

View File

@@ -25,12 +25,8 @@ const translations = getTranslations();
export default function translate(key, args = '') {
if (args) {
const translatedKey = translate(key);
return translatedKey.replace(/(\{\{\d\}\}|\{\d\})/g, (translatedKeyDbl) => {
if (translatedKeyDbl.substring(0, 2) === '{{') {
return translatedKeyDbl;
}
const match = parseInt(translatedKey.match(/\d/)[0]);
return args[match];
return translatedKey.replace(/\{(\d+)\}/g, (match, index) => {
return args[index];
});
}