summaryrefslogtreecommitdiff
path: root/src/misc/i18n.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-11-12 02:02:25 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-11-12 02:02:25 +0900
commit0e4a111f81cceed275d9bec2695f6e401fb654d8 (patch)
tree40874799472fa07416f17b50a398ac33b7771905 /src/misc/i18n.ts
parentupdate deps (diff)
downloadmisskey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.gz
misskey-0e4a111f81cceed275d9bec2695f6e401fb654d8.tar.bz2
misskey-0e4a111f81cceed275d9bec2695f6e401fb654d8.zip
refactoring
Resolve #7779
Diffstat (limited to 'src/misc/i18n.ts')
-rw-r--r--src/misc/i18n.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/misc/i18n.ts b/src/misc/i18n.ts
deleted file mode 100644
index 4fa398763a..0000000000
--- a/src/misc/i18n.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-export class I18n<T extends Record<string, any>> {
- public locale: T;
-
- constructor(locale: T) {
- this.locale = locale;
-
- //#region BIND
- this.t = this.t.bind(this);
- //#endregion
- }
-
- // string にしているのは、ドット区切りでのパス指定を許可するため
- // なるべくこのメソッド使うよりもlocale直接参照の方がvueのキャッシュ効いてパフォーマンスが良いかも
- public t(key: string, args?: Record<string, any>): string {
- try {
- let str = key.split('.').reduce((o, i) => o[i], this.locale) as string;
-
- if (args) {
- for (const [k, v] of Object.entries(args)) {
- str = str.replace(`{${k}}`, v);
- }
- }
- return str;
- } catch (e) {
- console.warn(`missing localization '${key}'`);
- return key;
- }
- }
-}