wip
This commit is contained in:
parent
d5f345c8f9
commit
ff7bb97d8e
19 changed files with 58 additions and 146 deletions
|
|
@ -17,12 +17,19 @@ export default class Replacer {
|
|||
}
|
||||
|
||||
private get(key: string) {
|
||||
let text = locale[this.lang];
|
||||
const texts = locale[this.lang];
|
||||
|
||||
if (texts == null) {
|
||||
console.warn(`lang '${this.lang}' is not supported`);
|
||||
return key; // Fallback
|
||||
}
|
||||
|
||||
let text;
|
||||
|
||||
// Check the key existance
|
||||
const error = key.split('.').some(k => {
|
||||
if (text.hasOwnProperty(k)) {
|
||||
text = text[k];
|
||||
if (texts.hasOwnProperty(k)) {
|
||||
text = texts[k];
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue