add en_US structure for plain-text
This commit is contained in:
+14
-4
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user