feat: improve i18n and add some translation

Signed-off-by: turbodog <turbodog1003@gmail.com>
This commit is contained in:
turbodog 2021-06-17 22:43:30 +08:00 committed by turbodog03
parent ce60a76920
commit 3a806c14ff
6 changed files with 71 additions and 51 deletions

View File

@ -40,7 +40,7 @@ export const ResetModal = (props) => {
return;
}
if (code === "") {
Setting.showMessage("error", i18next.t("user:Empty Code"));
Setting.showMessage("error", i18next.t("code:Empty Code"));
return;
}
setConfirmLoading(true);
@ -85,9 +85,9 @@ export const ResetModal = (props) => {
</Row>
<Row style={{width: "100%", marginBottom: "20px"}}>
<CountDownInput
defaultButtonText={i18next.t("user:Send code")}
textBefore={i18next.t("user:Code You Received")}
placeHolder={i18next.t("user:Enter your code")}
defaultButtonText={i18next.t("code:Send code")}
textBefore={i18next.t("code:Code You Received")}
placeHolder={i18next.t("code:Enter your code")}
onChange={setCode}
onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[dest, destType, org?.owner + "/" + org?.name]}

View File

@ -111,7 +111,7 @@ class TokenListPage extends React.Component {
}
},
{
title: i18next.t("token:Application"),
title: i18next.t("general:Application"),
dataIndex: 'application',
key: 'application',
width: '120px',
@ -125,7 +125,7 @@ class TokenListPage extends React.Component {
}
},
{
title: i18next.t("token:Organization"),
title: i18next.t("general:Organization"),
dataIndex: 'organization',
key: 'organization',
width: '120px',
@ -139,7 +139,7 @@ class TokenListPage extends React.Component {
}
},
{
title: i18next.t("token:User"),
title: i18next.t("general:User"),
dataIndex: 'user',
key: 'user',
width: '120px',
@ -153,7 +153,7 @@ class TokenListPage extends React.Component {
}
},
{
title: i18next.t("token:Authorization code"),
title: i18next.t("general:Authorization code"),
dataIndex: 'code',
key: 'code',
// width: '150px',
@ -163,7 +163,7 @@ class TokenListPage extends React.Component {
}
},
{
title: i18next.t("token:Access token"),
title: i18next.t("general:Access token"),
dataIndex: 'accessToken',
key: 'accessToken',
// width: '150px',
@ -174,14 +174,14 @@ class TokenListPage extends React.Component {
}
},
{
title: i18next.t("token:Expires in"),
title: i18next.t("general:Expires in"),
dataIndex: 'expiresIn',
key: 'expiresIn',
width: '120px',
sorter: (a, b) => a.expiresIn - b.expiresIn,
},
{
title: i18next.t("token:Scope"),
title: i18next.t("general:Scope"),
dataIndex: 'scope',
key: 'scope',
width: '100px',

View File

@ -217,7 +217,7 @@ class ForgetPage extends React.Component {
});
}}
prefix={<UserOutlined />}
placeholder={i18next.t("signup:username, Email or phone")}
placeholder={i18next.t("login:username, Email or phone")}
/>
</Form.Item>
<br />
@ -311,7 +311,7 @@ class ForgetPage extends React.Component {
{
required: true,
message: i18next.t(
"forget:Please input your verification code!"
"code:Please input your verification code!"
),
},
]}
@ -319,8 +319,8 @@ class ForgetPage extends React.Component {
{this.state.verifyType === "email" ? (
<CountDownInput
disabled={this.state.username === "" || this.state.verifyType === ""}
placeHolder={i18next.t("forget:Verify code")}
defaultButtonText={i18next.t("user:Send code")}
placeHolder={i18next.t("code:Verify code")}
defaultButtonText={i18next.t("code:Send code")}
onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[
this.state.email,
@ -334,8 +334,8 @@ class ForgetPage extends React.Component {
) : (
<CountDownInput
disabled={this.state.username === "" || this.state.verifyType === ""}
placeHolder={i18next.t("forget:Verify code")}
defaultButtonText={i18next.t("User:Send code")}
placeHolder={i18next.t("code:Verify code")}
defaultButtonText={i18next.t("code:Send code")}
onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[
this.state.phone,

View File

@ -141,7 +141,7 @@ class SignupPage extends React.Component {
rules={[
{
required: required,
message: i18next.t("login:Please input your username!"),
message: i18next.t("forget:Please input your username!"),
whitespace: true,
},
]}
@ -202,14 +202,14 @@ class SignupPage extends React.Component {
</Form.Item>
<Form.Item
name="emailCode"
label={i18next.t("signup:Email code")}
label={i18next.t("code:Email code")}
rules={[{
required: required,
message: i18next.t("signup:Please input your verification code!"),
message: i18next.t("code:Please input your verification code!"),
}]}
>
<CountDownInput
defaultButtonText={i18next.t("user:Send code")}
defaultButtonText={i18next.t("code:Send code")}
onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[this.state.email, "email", application?.organizationObj.owner + "/" + application?.organizationObj.name]}
coolDownTime={60}
@ -282,16 +282,16 @@ class SignupPage extends React.Component {
</Form.Item>
<Form.Item
name="phoneCode"
label={i18next.t("signup:Phone code")}
label={i18next.t("code:Phone code")}
rules={[
{
required: required,
message: i18next.t("signup:Please input your phone verification code!"),
message: i18next.t("code:Please input your phone verification code!"),
},
]}
>
<CountDownInput
defaultButtonText={i18next.t("user:Send code")}
defaultButtonText={i18next.t("code:Send code")}
onButtonClick={UserBackend.sendCode}
onButtonClickArgs={[this.state.phone, "phone", application.organizationObj.owner + "/" + application.organizationObj.name]}
coolDownTime={60}

View File

@ -5,7 +5,9 @@
"Organizations": "Organizations",
"Providers": "Providers",
"Users": "Users",
"User": "User",
"Applications": "Applications",
"Application": "Application",
"Save": "Save",
"Add": "Add",
"Action": "Action",
@ -35,7 +37,11 @@
"Applications that requires authentication": "Applications that requires authentication",
"Swagger": "Swagger",
"Phone Prefix": "Phone Prefix",
"Enter the code": "Enter the code"
"Enter the code": "Enter the code",
"Authorization code":"Authorization code",
"Access token":"Access token",
"Expires in":"Expires in",
"Scope":"Scope"
},
"signup":
{
@ -56,7 +62,21 @@
"sign in now": "sign in now",
"Your account has been created!": "Your account has been created!",
"Please click the below button to sign in": "Please click the below button to sign in",
"code sent": "code sent",
"Missing parameter.": "Missing parameter."
},
"code":
{
"Verify code": "Verify code",
"Please input your verification code!": "Please input your verification code!",
"Send code": "Send code",
"Empty Code": "Empty Code",
"Code Sent": "Code Sent",
"Code You Received": "Code You Received",
"Enter your code": "Enter your code",
"You can only send one code in 60s.": "You can only send one code in 60s.",
"Code has not been sent yet!": "Code has not been sent yet!",
"You should verify your code in 5 min!": "You should verify your code in 5 min!",
"Wrong code!": "Wrong code!",
"Email code": "Email code",
"Phone code": "Phone code",
"PhoneCode has not been sent yet!": "Phone code has not been sent yet!",
@ -65,7 +85,8 @@
"EmailYou should verify your code in 10 min!": "You should verify your email verification code in 10 min!",
"PhoneWrong code!": "Wrong phone verification code!",
"EmailWrong code!": "Wrong email verification code!",
"Missing parameter.": "Missing parameter."
"Missing parameter.": "Missing parameter.",
"Submit and complete": "Submit and complete"
},
"login":
{
@ -150,23 +171,14 @@
"input password": "input password",
"Reset Email...": "Reset Email...",
"Reset Phone...": "Reset Phone...",
"Send code": "Send code",
"Empty email": "Empty Email",
"Empty phone": "Empty Phone",
"Empty Code": "Empty Code",
"phone reset": "Phone Reset",
"email reset": "Email Reset",
"Code Sent": "Code Sent",
"Input your email": "Input your email",
"Input your phone number": "Input your phone number",
"New phone": "New Phone",
"New email": "New Email",
"Code You Received": "Code You Received",
"Enter your code": "Enter your code",
"You can only send one code in 60s.": "You can only send one code in 60s.",
"Code has not been sent yet!": "Code has not been sent yet!",
"You should verify your code in 5 min!": "You should verify your code in 5 min!",
"Wrong code!": "Wrong code!",
"Invalid phone number": "Invalid phone number",
"Invalid Email address": "Invalid Email address",
"Turing test failed.": "Turing test failed.",
@ -192,7 +204,6 @@
"Please input your password!": "Please input your password!",
"Please confirm your password!": "Please confirm your password!",
"Please input your Email/Phone string!": "Please input your Email/Phone string!",
"Please input your verification code!": "Please input your verification code!",
"Your confirmed password is inconsistent with the password!": "Your confirmed password is inconsistent with the password!",
"Account": "Account",
"Verify": "Verify",
@ -201,7 +212,6 @@
"Password": "Password",
"Next Step": "Next Step",
"Confirm": "Confirm",
"Verify code": "Verify code",
"Email/Phone's format wrong!": "Email/Phone's format wrong!",
"Email/Phone": "Email/Phone",
"Change Password": "Change Password",

View File

@ -5,7 +5,9 @@
"Organizations": "组织",
"Providers": "提供商",
"Users": "用户",
"User": "用户",
"Applications": "应用",
"Application": "应用",
"Save": "保存",
"Add": "添加",
"Action": "操作",
@ -35,7 +37,11 @@
"Applications that requires authentication": "需要鉴权的应用",
"Swagger": "API总览",
"Phone Prefix": "手机号前缀",
"Enter the code": "输入验证码"
"Enter the code": "输入验证码",
"Authorization code": "授权码",
"Access token": "访问令牌",
"Expires in": "有效期",
"Scope": "范围"
},
"signup":
{
@ -56,6 +62,20 @@
"sign in now": "立即登录",
"Your account has been created!": "您的账号已创建!",
"Please click the below button to sign in": "请点击下方按钮登录",
"Missing parameter.": "缺少参数"
},
"code":
{
"Please input your verification code!": "请输入您的验证码",
"Verify code": "验证码",
"Enter your code": "输入你的验证码",
"You can only send one code in 60s.": "每分钟你只能发送一次验证码",
"Code has not been sent yet!": "你还没有发送验证码",
"You should verify your code in 5 min!": "验证码已超时。你应该在 5 分钟内完成验证。",
"Wrong code!": "验证码错误!",
"Code You Received": "验证码",
"Empty Code": "验证码为空",
"Send code": "发送验证码",
"code sent": "验证码已发送",
"Email code": "邮箱验证码",
"Phone code": "手机验证码",
@ -65,7 +85,8 @@
"EmailYou should verify your code in 10 min!": "你应该在 10 分钟之内验证邮箱",
"PhoneWrong code!": "手机验证码错误",
"EmailWrong code!": "邮箱验证码错误",
"Missing parameter.": "缺少参数"
"Missing parameter.": "缺少参数",
"Submit and complete": "完成提交"
},
"login":
{
@ -150,23 +171,14 @@
"input password": "输入密码",
"Reset Email...": "重置邮箱...",
"Reset Phone...": "重置手机号...",
"Send code": "发送验证码",
"Empty email": "邮箱为空",
"Empty phone": "手机号为空",
"Empty Code": "验证码为空",
"phone reset": "手机号已设置",
"email reset": "邮箱已设置",
"Code Sent": "验证码已发送",
"Input your email": "请输入邮箱",
"Input your phone number": "输入手机号",
"New phone": "新手机号",
"New email": "新邮箱",
"Code You Received": "验证码",
"Enter your code": "输入你的验证码",
"You can only send one code in 60s.": "每分钟你只能发送一次验证码",
"Code has not been sent yet!": "你还没有发送验证码",
"You should verify your code in 5 min!": "验证码已超时。你应该在 5 分钟内完成验证。",
"Wrong code!": "验证码错误!",
"Invalid phone number": "手机号格式错误",
"Invalid Email address": "邮箱格式错误",
"Turing test failed.": "图灵验证失败,无法确认你是人类!",
@ -192,9 +204,7 @@
"Please input your password!": "请输入您的密码!",
"Please confirm your password!": "请确认您的密码!",
"Please input your Email/Phone string!": "请输入您的邮箱/手机号!",
"Please input your verification code!": "请输入您的验证码",
"Your confirmed password is inconsistent with the password!": "您确认的密码与密码不一致!",
"Verify code": "验证码",
"Password": "密码",
"Next Step": "下一步",
"Choose email verification or mobile verification": "选择邮箱验证或手机验证",