add global plain text

This commit is contained in:
2024-03-06 00:02:00 +08:00
parent 83d2e8419e
commit a9d9415def
3 changed files with 88 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import { PageFooterText, pageFooterZhCn } from './PageFooter';
import { MainPageText, mainPageZhCn } from './MainPage';
interface TextRecord {
pageFooter: PageFooterText;
mainPage: MainPageText;
}
const textZhCn: TextRecord = {
pageFooter: pageFooterZhCn,
mainPage: mainPageZhCn,
};
// type Lang = 'zh_CN' | 'en_US' | ...;
type Lang = 'zh_CN';
class PlainText {
private readonly textZhCn: TextRecord;
private lang: Lang;
constructor() {
this.textZhCn = textZhCn;
this.lang = 'zh_CN';
}
setLang(lang: Lang) {
this.lang = lang;
}
get(): TextRecord {
if (this.lang == 'zh_CN') {
return this.textZhCn;
}
return this.textZhCn;
}
}
const pt = new PlainText();
export default pt;