add global plain text
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user