feat(ui): add i18n support

This commit is contained in:
hexxa 2021-08-25 18:47:53 +08:00 committed by Hexxa
parent 600c1e6a9e
commit 072b8b7fd7
3 changed files with 43 additions and 0 deletions

View 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": "关于",
});

View 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);
}
}
}

View file

@ -0,0 +1,8 @@
import { Map } from "immutable";
const adContent = `
bug等, github库提交issue, 😎.`;
export const msgs: Map<string, string> = Map({
"loader.top.about": "关于",
});