1
0
Fork 0
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:
McMatts 2022-03-01 20:01:06 -05:00
parent 59c929d251
commit 8a25509019
9 changed files with 33 additions and 18 deletions

View file

@ -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;
},
});