mirror of
https://github.com/documize/community.git
synced 2025-07-25 08:09:43 +02:00
Implement basic i18n client-side foundation
This commit is contained in:
parent
59c929d251
commit
8a25509019
9 changed files with 33 additions and 18 deletions
|
@ -20,14 +20,28 @@ export default Service.extend({
|
|||
});
|
||||
},
|
||||
|
||||
localize(key) {
|
||||
localize(key, ...args) {
|
||||
console.log(this.session.locale);
|
||||
|
||||
let str = "";
|
||||
|
||||
switch(this.session.locale) {
|
||||
case "fr-FR":
|
||||
return "unsupported";
|
||||
str = "";
|
||||
break;
|
||||
default:
|
||||
return this.langs.enUS[key];
|
||||
}
|
||||
str = this.langs.enUS[key];
|
||||
}
|
||||
|
||||
if (str === "") {
|
||||
console.log("i18n miss", key);
|
||||
return;
|
||||
}
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
str = str.replace(`{${i+1}}`, args[i]);
|
||||
}
|
||||
|
||||
return str;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue