mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 06:56:43 +08:00
Adds a variable to the translation.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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`);
|
||||
|
||||
Reference in New Issue
Block a user