-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
62 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"welcome": "Welcome", | ||
"welcomeTips": "I'm your pair programmer and I'm here to help you get things done faster." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { I18n, Locale } from "val-i18n"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const interop = (p: Promise<any>) => p.then((mod) => mod.default || mod); | ||
|
||
export const locales: Record<string, Promise<Locale>> = { | ||
en: interop(import("./en.json")), | ||
"zh-cn": interop(import("./zh-cn.json")), | ||
}; | ||
|
||
export const createI18n = async (locale: string) => { | ||
return I18n.preload(locale, (lang) => locales[lang]); | ||
}; | ||
|
||
export class I18nManager { | ||
public static i18n: I18n; | ||
|
||
public static async crate(locale: string) { | ||
const i18n = await createI18n(locale); | ||
this.i18n = i18n; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"welcome": "欢迎", | ||
"welcomeTips": "我是你的编程伙伴,我在这里帮助你更快地完成工作。" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters