feat(ui): add i18n support
This commit is contained in:
parent
600c1e6a9e
commit
072b8b7fd7
3 changed files with 43 additions and 0 deletions
8
src/client/web/src/i18n/en_US.ts
Normal file
8
src/client/web/src/i18n/en_US.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { Map } from "immutable";
|
||||||
|
|
||||||
|
const adContent = `
|
||||||
|
If you have any question, you can submit an issue in the github repo. But owner may be out of the office in the weekend 😎.`;
|
||||||
|
|
||||||
|
export const msgs: Map<string, string> = Map({
|
||||||
|
"loader.top.about": "关于",
|
||||||
|
});
|
27
src/client/web/src/i18n/msger.ts
Normal file
27
src/client/web/src/i18n/msger.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
import { Map } from "immutable";
|
||||||
|
|
||||||
|
import { msgs as enMsgs } from "./en_US";
|
||||||
|
import { msgs as cnMsgs } from "./zh_CN";
|
||||||
|
|
||||||
|
export class Msger {
|
||||||
|
private msgs: Map<string, string>;
|
||||||
|
constructor(msgs: Map<string, string>) {
|
||||||
|
this.msgs = msgs;
|
||||||
|
}
|
||||||
|
getMsg(key: string): string {
|
||||||
|
return this.msgs.get(key, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class MsgPackage {
|
||||||
|
static getPkg(key: string): Map<string, string> {
|
||||||
|
switch (key) {
|
||||||
|
case "en-US":
|
||||||
|
return Map(enMsgs);
|
||||||
|
case "zh-CN":
|
||||||
|
return Map(cnMsgs);
|
||||||
|
default:
|
||||||
|
return Map(enMsgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
src/client/web/src/i18n/zh_CN.ts
Normal file
8
src/client/web/src/i18n/zh_CN.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { Map } from "immutable";
|
||||||
|
|
||||||
|
const adContent = `
|
||||||
|
发现bug等, 可至下方github库提交issue, 不过周末可能不上班😎.`;
|
||||||
|
|
||||||
|
export const msgs: Map<string, string> = Map({
|
||||||
|
"loader.top.about": "关于",
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue