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