Improve i18n.

This commit is contained in:
Yang Luo
2021-05-24 20:48:04 +08:00
parent 2fff5f79ce
commit b23e8cf90c
5 changed files with 24 additions and 26 deletions

View File

@ -112,6 +112,23 @@ export function swapRow(array, i, j) {
return [...array.slice(0, i), array[j], ...array.slice(i + 1, j), array[i], ...array.slice(j + 1)];
}
export function trim(str, ch) {
if (str === undefined) {
return undefined;
}
let start = 0;
let end = str.length;
while(start < end && str[start] === ch)
++start;
while(end > start && str[end - 1] === ch)
--end;
return (start > 0 || end < str.length) ? str.substring(start, end) : str;
}
export function isMobile() {
// return getIsMobileView();
return isMobileDevice;

View File

@ -234,7 +234,7 @@ class UserEditPage extends React.Component {
</Col>
</Row>
<Row style={{marginTop: '20px'}}>
<CropperDiv buttonText={i18next.t("user:Upload a photo...")} title={i18next.t("user:Upload a photo")} targetFunction={UserBackend.uploadAvatar} />
<CropperDiv buttonText={`${i18next.t("user:Upload a photo")}...`} title={i18next.t("user:Upload a photo")} targetFunction={UserBackend.uploadAvatar} />
</Row>
</Col>
</Row>
@ -267,7 +267,7 @@ class UserEditPage extends React.Component {
<Input value={this.state.user.email} disabled />
</Col>
<Col span={11} >
{ this.state.user.id === this.props.account.id ? (<ResetModal org={this.state.application?.organizationObj} buttonText={i18next.t("user:Reset Email")} destType={"email"} coolDownTime={60}/>) : null}
{ this.state.user.id === this.props.account.id ? (<ResetModal org={this.state.application?.organizationObj} buttonText={i18next.t("user:Reset Email...")} destType={"email"} coolDownTime={60}/>) : null}
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
@ -278,7 +278,7 @@ class UserEditPage extends React.Component {
<Input value={this.state.user.phone} addonBefore={`+${this.state.application?.organizationObj.phonePrefix}`} disabled />
</Col>
<Col span={11} >
{ this.state.user.id === this.props.account.id ? (<ResetModal org={this.state.application?.organizationObj} buttonText={i18next.t("user:Reset Phone")} destType={"phone"} coolDownTime={60}/>) : null}
{ this.state.user.id === this.props.account.id ? (<ResetModal org={this.state.application?.organizationObj} buttonText={i18next.t("user:Reset Phone...")} destType={"phone"} coolDownTime={60}/>) : null}
</Col>
</Row>
<Row style={{marginTop: '20px'}} >

View File

@ -71,23 +71,6 @@ export function renderMessageLarge(ths, msg) {
}
}
export function trim(str, ch) {
if (str === undefined) {
return undefined;
}
let start = 0;
let end = str.length;
while(start < end && str[start] === ch)
++start;
while(end > start && str[end - 1] === ch)
--end;
return (start > 0 || end < str.length) ? str.substring(start, end) : str;
}
export function getOAuthGetParameters(params) {
const queries = (params !== undefined) ? params : new URLSearchParams(window.location.search);
const clientId = queries.get("client_id");

View File

@ -108,7 +108,6 @@
"user":
{
"Edit User": "Edit User",
"Upload a photo...": "Upload a photo...",
"Upload a photo": "Upload a photo",
"Select a photo...": "Select a photo...",
"Set new profile picture": "Set new profile picture",
@ -139,8 +138,8 @@
"Password": "Password",
"Cancel": "Cancel",
"input password": "input password",
"Reset Email": "Reset Email",
"Reset Phone": "Reset Phone",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Reset Phone...",
"Send Code": "Send Code",
"Empty email": "Empty Email",
"Empty phone": "Empty Phone",

View File

@ -108,7 +108,6 @@
"user":
{
"Edit User": "修改用户",
"Upload a photo...": "上传头像...",
"Upload a photo": "上传头像",
"Select a photo...": "选择图片...",
"Set new profile picture": "设置新头像",
@ -139,8 +138,8 @@
"Password": "密码",
"Cancel": "取消",
"input password": "输入密码",
"Reset Email": "重置邮箱",
"Reset Phone": "重置手机号",
"Reset Email...": "重置邮箱...",
"Reset Phone...": "重置手机号...",
"Send Code": "发送验证码",
"Empty email": "邮箱为空",
"Empty phone": "手机号为空",