add en_US structure for plain-text

This commit is contained in:
Dawn_Ocean
2024-03-07 11:45:34 +08:00
parent 34c3753d2c
commit c63b7fcca8
4 changed files with 88 additions and 4 deletions
+14 -4
View File
@@ -1,6 +1,6 @@
import { PageFooterText, pageFooterZhCn } from './PageFooter';
import { MainPageText, mainPageZhCn } from './MainPage';
import { UserPageText, userPageZhCn } from './UserPage';
import { PageFooterText, pageFooterZhCn, pageFooterEnUs } from './PageFooter';
import { MainPageText, mainPageZhCn, mainPageEnUs } from './MainPage';
import { UserPageText, userPageZhCn, userPageEnUs } from './UserPage';
interface TextRecord {
pageFooter: PageFooterText;
@@ -14,15 +14,23 @@ const textZhCn: TextRecord = {
userPage: userPageZhCn,
};
const textEnUs: TextRecord = {
pageFooter: pageFooterEnUs,
mainPage: mainPageEnUs,
userPage: userPageEnUs,
};
// type Lang = 'zh_CN' | 'en_US' | ...;
type Lang = 'zh_CN';
type Lang = 'zh_CN' | 'en_US';
class PlainText {
private readonly textZhCn: TextRecord;
private readonly textEnUs: TextRecord;
private lang: Lang;
constructor() {
this.textZhCn = textZhCn;
this.textEnUs = textEnUs;
this.lang = 'zh_CN';
}
@@ -33,6 +41,8 @@ class PlainText {
get(): TextRecord {
if (this.lang == 'zh_CN') {
return this.textZhCn;
} else if (this.lang == 'en_US') {
return this.textEnUs;
}
return this.textZhCn;
}