From ebadd7fd3f255af3dd5035afe1d0d75337fa39a4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 13 Feb 2021 12:28:26 +0900 Subject: wip: email notification --- src/client/scripts/i18n.ts | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/client/scripts/i18n.ts (limited to 'src/client/scripts') diff --git a/src/client/scripts/i18n.ts b/src/client/scripts/i18n.ts deleted file mode 100644 index d535e236bb..0000000000 --- a/src/client/scripts/i18n.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Notice: Service Workerでも使用します -export class I18n> { - public locale: T; - - constructor(locale: T) { - this.locale = locale; - - if (_DEV_) { - console.log('i18n', this.locale); - } - - //#region BIND - this.t = this.t.bind(this); - //#endregion - } - - // string にしているのは、ドット区切りでのパス指定を許可するため - // なるべくこのメソッド使うよりもlocale直接参照の方がvueのキャッシュ効いてパフォーマンスが良いかも - public t(key: string, args?: Record): string { - try { - let str = key.split('.').reduce((o, i) => o[i], this.locale) as string; - - if (_DEV_) { - if (!str.includes('{')) { - console.warn(`i18n: '${key}' has no any arg. so ref prop directly instead of call this method.`); - } - } - - if (args) { - for (const [k, v] of Object.entries(args)) { - str = str.replace(`{${k}}`, v); - } - } - return str; - } catch (e) { - if (_DEV_) { - console.warn(`missing localization '${key}'`); - return `⚠'${key}'⚠`; - } - - return key; - } - } -} -- cgit v1.2.3-freya