forked from FoundKeyGang/FoundKey
Fix bug
This commit is contained in:
parent
42dd092334
commit
1b9c69f793
2 changed files with 4 additions and 4 deletions
|
@ -43,7 +43,7 @@
|
||||||
if (LANGS.includes(navigator.language)) {
|
if (LANGS.includes(navigator.language)) {
|
||||||
lang = navigator.language;
|
lang = navigator.language;
|
||||||
} else {
|
} else {
|
||||||
lang = LANGS.find(x => x.split('-')[0] == lang);
|
lang = LANGS.find(x => x.split('-')[0] == navigator.language);
|
||||||
|
|
||||||
if (lang == null) {
|
if (lang == null) {
|
||||||
// Fallback
|
// Fallback
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default class Replacer {
|
||||||
if (text.hasOwnProperty(path)) {
|
if (text.hasOwnProperty(path)) {
|
||||||
text = text[path];
|
text = text[path];
|
||||||
} else {
|
} else {
|
||||||
if (this.lang === 'ja') console.warn(`path '${path}' not found`);
|
if (this.lang === 'ja-JP') console.warn(`path '${path}' not found`);
|
||||||
return key; // Fallback
|
return key; // Fallback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,10 @@ export default class Replacer {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (this.lang === 'ja') console.warn(`key '${key}' not found in '${path}'`);
|
if (this.lang === 'ja-JP') console.warn(`key '${key}' not found in '${path}'`);
|
||||||
return key; // Fallback
|
return key; // Fallback
|
||||||
} else if (typeof text !== 'string') {
|
} else if (typeof text !== 'string') {
|
||||||
if (this.lang === 'ja') console.warn(`key '${key}' is not string in '${path}'`);
|
if (this.lang === 'ja-JP') console.warn(`key '${key}' is not string in '${path}'`);
|
||||||
return key; // Fallback
|
return key; // Fallback
|
||||||
} else {
|
} else {
|
||||||
return text;
|
return text;
|
||||||
|
|
Loading…
Reference in a new issue