From b23e8cf90c2b032a8ac28174bf7e69345e1aa7a2 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Mon, 24 May 2021 20:48:04 +0800 Subject: [PATCH] Improve i18n. --- web/src/Setting.js | 17 +++++++++++++++++ web/src/UserEditPage.js | 6 +++--- web/src/auth/Util.js | 17 ----------------- web/src/locales/en.json | 5 ++--- web/src/locales/zh.json | 5 ++--- 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/web/src/Setting.js b/web/src/Setting.js index 1841f6bb..31485ddb 100644 --- a/web/src/Setting.js +++ b/web/src/Setting.js @@ -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; diff --git a/web/src/UserEditPage.js b/web/src/UserEditPage.js index 70a0e738..f8984308 100644 --- a/web/src/UserEditPage.js +++ b/web/src/UserEditPage.js @@ -234,7 +234,7 @@ class UserEditPage extends React.Component { - + @@ -267,7 +267,7 @@ class UserEditPage extends React.Component { - { this.state.user.id === this.props.account.id ? () : null} + { this.state.user.id === this.props.account.id ? () : null} @@ -278,7 +278,7 @@ class UserEditPage extends React.Component { - { this.state.user.id === this.props.account.id ? () : null} + { this.state.user.id === this.props.account.id ? () : null} diff --git a/web/src/auth/Util.js b/web/src/auth/Util.js index 6f27f83f..57922dc5 100644 --- a/web/src/auth/Util.js +++ b/web/src/auth/Util.js @@ -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"); diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 8cf9b27f..fbf290f8 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -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", diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index e5654889..72571e48 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -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": "手机号为空",