diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-02-10 10:27:05 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-02-10 10:27:05 +0900 |
| commit | ff7bb97d8ee04a6a56aaea8a09f9b4d7170f2064 (patch) | |
| tree | 54440ed27272a0c75fdd2ba9d3b83b095993c27c /src/common | |
| parent | wip (diff) | |
| download | sharkey-ff7bb97d8ee04a6a56aaea8a09f9b4d7170f2064.tar.gz sharkey-ff7bb97d8ee04a6a56aaea8a09f9b4d7170f2064.tar.bz2 sharkey-ff7bb97d8ee04a6a56aaea8a09f9b4d7170f2064.zip | |
wip
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/build/i18n.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/common/build/i18n.ts b/src/common/build/i18n.ts index 1ae22147c4..500b8814fd 100644 --- a/src/common/build/i18n.ts +++ b/src/common/build/i18n.ts @@ -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; |