wip
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user