add partial localization support for report page

yhy
Dawn_Ocean 2024-03-07 14:38:37 +08:00
parent 3232994fb2
commit 1a30ff6def
3 changed files with 27 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import { AtTextarea, AtButton, AtForm, AtMessage } from 'taro-ui';
import { Component, ReactNode } from 'react'; import { Component, ReactNode } from 'react';
import './report.scss'; import './report.scss';
import Taro from '@tarojs/taro'; import Taro from '@tarojs/taro';
import pt from '@/plain-text';
export default class SettingsPage extends Component { export default class SettingsPage extends Component {
state = { state = {
@ -49,7 +50,7 @@ export default class SettingsPage extends Component {
value={this.state.report} value={this.state.report}
onChange={this.handleChange.bind(this)} onChange={this.handleChange.bind(this)}
maxLength={200} maxLength={200}
placeholder='无论是有关于小程序的建议还是关于E志者协会的建议都可以提出来哦' placeholder={pt.get().reportPage.placeHolderText}
/> />
<AtButton <AtButton
loading={this.state.isLoading} loading={this.state.isLoading}
@ -57,10 +58,10 @@ export default class SettingsPage extends Component {
type='primary' type='primary'
disabled={this.state.isDisable} disabled={this.state.isDisable}
> >
{pt.get().reportPage.submitText}
</AtButton> </AtButton>
<AtButton formType='reset' type='secondary'> <AtButton formType='reset' type='secondary'>
{pt.get().reportPage.resetText}
</AtButton> </AtButton>
</AtForm> </AtForm>
); );

View File

@ -0,0 +1,19 @@
export interface ReportPageText {
placeHolderText: string;
submitText: string;
resetText: string;
}
export const reportPageZhCn: ReportPageText = {
placeHolderText:
'无论是有关于小程序的建议还是关于E志者协会的建议都可以提出来哦',
submitText: '提交',
resetText: '清空',
};
export const reportPageEnUs: ReportPageText = {
placeHolderText:
'无论是有关于小程序的建议还是关于E志者协会的建议都可以提出来哦',
submitText: 'Submit',
resetText: 'Reset',
};

View File

@ -7,6 +7,7 @@ import {
settingsPageEnUs, settingsPageEnUs,
settingsPageZhCn, settingsPageZhCn,
} from './SettingsPage'; } from './SettingsPage';
import { ReportPageText, reportPageEnUs, reportPageZhCn } from './ReportPage';
interface TextRecord { interface TextRecord {
pageFooter: PageFooterText; pageFooter: PageFooterText;
@ -14,6 +15,7 @@ interface TextRecord {
userPage: UserPageText; userPage: UserPageText;
tabBar: TabBarText; tabBar: TabBarText;
settingsPage: SettingsPageText; settingsPage: SettingsPageText;
reportPage: ReportPageText;
} }
const textZhCn: TextRecord = { const textZhCn: TextRecord = {
@ -22,6 +24,7 @@ const textZhCn: TextRecord = {
userPage: userPageZhCn, userPage: userPageZhCn,
tabBar: tabBarZhCn, tabBar: tabBarZhCn,
settingsPage: settingsPageZhCn, settingsPage: settingsPageZhCn,
reportPage: reportPageZhCn,
}; };
const textEnUs: TextRecord = { const textEnUs: TextRecord = {
@ -30,6 +33,7 @@ const textEnUs: TextRecord = {
userPage: userPageEnUs, userPage: userPageEnUs,
tabBar: tabBarEnUs, tabBar: tabBarEnUs,
settingsPage: settingsPageEnUs, settingsPage: settingsPageEnUs,
reportPage: reportPageEnUs,
}; };
// type Lang = 'zh_CN' | 'en_US' | ...; // type Lang = 'zh_CN' | 'en_US' | ...;