From b54f01dfe58187090a5535ef5114fc50c93169f6 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Fri, 13 May 2022 18:57:14 +0800 Subject: [PATCH] i18n: user profile --- public/locales/en-US/application.json | 11 ++++++-- public/locales/zh-CN/application.json | 9 ++++++- src/component/Setting/Profile.js | 39 ++++++++++++++++----------- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/public/locales/en-US/application.json b/public/locales/en-US/application.json index 500bc9f..dd958e6 100644 --- a/public/locales/en-US/application.json +++ b/public/locales/en-US/application.json @@ -359,7 +359,7 @@ "uid": "UID", "nickname": "Nickname", "group": "Group", - "regTime": "Sign in date", + "regTime": "Sign up date", "privacyAndSecurity": "Privacy and security", "profilePage": "Public profile", "accountPassword": "Password", @@ -419,6 +419,13 @@ "downloading": "Downloading", "transferring": "Transferring", "indexing": "Indexing", - "listing": "Inserting" + "listing": "Inserting", + "allShares": "Shared", + "trendingShares": "Trending", + "totalShares": "Created shares", + "fileName": "File name", + "shareDate": "Shared at", + "downloadNumber": "Downloads", + "viewNumber": "Views" } } \ No newline at end of file diff --git a/public/locales/zh-CN/application.json b/public/locales/zh-CN/application.json index ab3c34c..4454529 100644 --- a/public/locales/zh-CN/application.json +++ b/public/locales/zh-CN/application.json @@ -409,6 +409,13 @@ "downloading": "下载中", "transferring": "转存中", "indexing": "索引中", - "listing": "插入中" + "listing": "插入中", + "allShares": "全部分享", + "trendingShares": "热门分享", + "totalShares": "分享总数", + "fileName": "文件名", + "shareDate": "分享日期", + "downloadNumber": "下载次数", + "viewNumber": "浏览次数" } } \ No newline at end of file diff --git a/src/component/Setting/Profile.js b/src/component/Setting/Profile.js index 8b980c9..45435f3 100644 --- a/src/component/Setting/Profile.js +++ b/src/component/Setting/Profile.js @@ -20,6 +20,7 @@ import { withRouter } from "react-router"; import Pagination from "@material-ui/lab/Pagination"; import { formatLocalTime } from "../../utils/datetime"; import { toggleSnackbar } from "../../redux/explorer"; +import { withTranslation } from "react-i18next"; const styles = (theme) => ({ layout: { @@ -190,7 +191,7 @@ class ProfileCompoment extends Component { }; render() { - const { classes } = this.props; + const { classes, t } = this.props; return (
@@ -221,9 +222,9 @@ class ProfileCompoment extends Component { onChange={this.handleChange} centered > - - - + + + {this.state.listType === 2 && (
@@ -238,7 +239,7 @@ class ProfileCompoment extends Component { color="textSecondary" variant="h6" > - UID + {t("setting.uid")} {this.state.user.id} @@ -254,7 +255,7 @@ class ProfileCompoment extends Component { color="textSecondary" variant="h6" > - 昵称 + {t("setting.nickname")} {this.state.user.nick} @@ -270,7 +271,7 @@ class ProfileCompoment extends Component { color="textSecondary" variant="h6" > - 用户组 + {t("setting.group")} {this.state.user.group} @@ -286,7 +287,7 @@ class ProfileCompoment extends Component { color="textSecondary" variant="h6" > - 分享总数 + {t("setting.totalShares")} {this.state.total} @@ -302,7 +303,7 @@ class ProfileCompoment extends Component { color="textSecondary" variant="h6" > - 注册日期 + {t("setting.regTime")} {this.state.user.date} @@ -318,13 +319,15 @@ class ProfileCompoment extends Component { - 文件名 + + {t("setting.fileName")} + - 分享日期 + {t("setting.shareDate")} - 下载次数 + {t( + "setting.downloadNumber" + )} - 浏览次数 + {t("setting.viewNumber")} @@ -363,7 +368,11 @@ class ProfileCompoment extends Component { {row.source ? row.source .name - : "[已失效]"} + : "[" + + t( + "share.expired" + ) + + "]"}