Adds a variable to the translation.

This commit is contained in:
gaba
2016-12-02 16:02:37 -08:00
parent 1cda5b9099
commit d12693ae47
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -54,7 +54,7 @@
},
"bandialog": {
"ban_user": "Ban User?",
"are_you_sure": "Are you sure you would like to ban {props.author.displayName}?",
"are_you_sure": "Are you sure you would like to ban {0}?",
"note": "Note: Banning this user will also place this comment in the Rejected queue.",
"cancel": "Cancel",
"yes_ban_user": "Yes, Ban User"
+3 -2
View File
@@ -48,7 +48,7 @@ class i18n {
* it works with nested translations (my.page.title)
*/
this.t = (key) => {
this.t = (key, att) => {
const arr = key.split('.');
let translation = this.translations;
try {
@@ -58,8 +58,9 @@ class i18n {
return key;
}
const val = String(translation);
let val = String(translation);
if (val) {
val = val.replace(/\{0\}/g, att);
return val;
} else {
console.warn(`${key} language key not set`);