Finish the i18n work for preference and dashboard.

This commit is contained in:
lishuang
2020-06-20 16:18:31 +08:00
parent f13543c54e
commit 5483b99376
10 changed files with 77 additions and 64 deletions
+7 -1
View File
@@ -19,7 +19,8 @@ let LangEn = {
activeIpTop10: 'Active IP TOP10',
loading: 'loading...',
date: 'Date',
num: 'Num'
num: 'Num',
warnHint: 'Hint: data in this page updates everyday at 5.a.m',
},
install: {
configMysql: "Config MySQL",
@@ -163,6 +164,11 @@ let LangEn = {
systemCleanupDescription: "This operation will cleanup everything except administrators' data",
systemCleanupPrompt: "This operation will cleanup everything except administrators' account data, please input login password.",
officeUrl: "Office Preview Url",
editPreference: "Edit Preference",
enterWebsiteName: "Please enter website name!",
enterZipMaxNumLimit: "Please enter zip max num!",
enterZipMaxSizeLimit: "Please enter zip max size!",
enterUserDefaultSizeLimit: "Please enter user's default size!",
},
share: {
shareDetail: "Share Detail",
+8 -1
View File
@@ -16,7 +16,8 @@ let LangZh = {
activeIpTop10: '活跃IP TOP10',
loading: '加载中…',
date: '日期',
num: '数量'
num: '数量',
warnHint: '温馨提示:本页面数据每日凌晨5点清洗一次',
},
install: {
configMysql: "配置MySQL",
@@ -143,6 +144,7 @@ let LangZh = {
},
preference: {
websiteName: "网站名称",
logo: "Logo",
logoSquare: "logo请使用正方形图片,否则在显示时会裁剪成正方形",
onlyAllowIco: "只允许上传.ico图标",
@@ -160,6 +162,11 @@ let LangZh = {
systemCleanupDescription: "重置系统将清空除管理员账号外所有数据",
systemCleanupPrompt: "重置系统将清空除管理员账号外所有数据,事关重大,请输入登录密码",
officeUrl: "Office预览链接",
editPreference: "设置网站偏好",
enterWebsiteName: "请输入网站名称!",
enterZipMaxNumLimit: "zip最大数量限制必填!",
enterZipMaxSizeLimit: "zip大小限制必填!",
enterUserDefaultSizeLimit: "默认用户空间大小必填!",
},
share: {
shareDetail: "分享详情",
+2 -1
View File
@@ -1,5 +1,6 @@
import MimeUtil from "./MimeUtil";
import StringUtil from "./StringUtil";
import Moon from "../model/global/Moon";
export default class FileUtil {
static isImage(name: string | null): boolean {
@@ -115,7 +116,7 @@ export default class FileUtil {
//human readable file size
static humanFileSize(bytes: number, si: boolean = false): string {
if (bytes == -1) {
return "无限制"
return Moon.t("preference.noLimit")
}
let thresh = si ? 1000 : 1024
+24 -24
View File
@@ -14,6 +14,7 @@ import DateUtil from '../../common/util/DateUtil';
import SortDirection from "../../common/model/base/SortDirection";
import FileUtil from "../../common/util/FileUtil";
import Matter from '../../common/model/matter/Matter';
import Moon from "../../common/model/global/Moon";
Echarts.registerTheme('tank_theme', theme);
@@ -79,11 +80,11 @@ export default class Index extends TankComponent<IProps, IState> {
data: ['PV', 'UV']
},
xAxis: {
name: "日期",
name: Moon.t("dashboard.date"),
data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
},
yAxis: {
name: "数量"
name: Moon.t("dashboard.num")
},
series: [{
name: 'PV',
@@ -259,24 +260,24 @@ export default class Index extends TankComponent<IProps, IState> {
return (
<div className="page-dashboard-index">
<TankTitle name={'监控统计'}>
<TankTitle name={Moon.t("layout.dashboard")}>
</TankTitle>
<Row gutter={18}>
<Col xs={24} sm={24} md={12} lg={6}>
<div className="text-block">
<div className="upper">
<div className="indicator">PV</div>
<div className="indicator">{Moon.t("dashboard.totalInvokeNum")}</div>
<div className="amount">{dashboard.totalInvokeNum}</div>
<div>
<RatePanel name="周环比" standardValue={this.standardWeekInvokeNum}
<RatePanel name={Moon.t("dashboard.weekRate")} standardValue={this.standardWeekInvokeNum}
compareValue={this.compareWeekInvokeNum}/>
<RatePanel name="日环比" standardValue={this.standardDayInvokeNum}
<RatePanel name={Moon.t("dashboard.dayRate")} standardValue={this.standardDayInvokeNum}
compareValue={this.compareDayInvokeNum}/>
</div>
</div>
<div className="lower">
PV:{dashboard.invokeNum}
{Moon.t("dashboard.yesterdayInvoke")}:{dashboard.invokeNum}
</div>
</div>
</Col>
@@ -284,17 +285,17 @@ export default class Index extends TankComponent<IProps, IState> {
<Col xs={24} sm={24} md={12} lg={6}>
<div className="text-block">
<div className="upper">
<div className="indicator">UV</div>
<div className="indicator">{Moon.t("dashboard.totalUV")}</div>
<div className="amount">{dashboard.totalUv}</div>
<div>
<RatePanel name="周环比" standardValue={this.standardWeekUv}
<RatePanel name={Moon.t("dashboard.weekRate")} standardValue={this.standardWeekUv}
compareValue={this.compareWeekUv}/>
<RatePanel name="日环比" standardValue={this.standardDayUv}
<RatePanel name={Moon.t("dashboard.dayRate")} standardValue={this.standardDayUv}
compareValue={this.compareDayUv}/>
</div>
</div>
<div className="lower">
UV:{dashboard.uv}
{Moon.t("dashboard.yesterdayUV")}:{dashboard.uv}
</div>
</div>
</Col>
@@ -303,17 +304,17 @@ export default class Index extends TankComponent<IProps, IState> {
<Col xs={24} sm={24} md={12} lg={6}>
<div className="text-block">
<div className="upper">
<div className="indicator"></div>
<div className="indicator">{Moon.t("dashboard.totalMatterNum")}</div>
<div className="amount">{dashboard.totalMatterNum}</div>
<div>
<RatePanel name="周环比" standardValue={this.standardWeekMatterNum}
<RatePanel name={Moon.t("dashboard.weekRate")} standardValue={this.standardWeekMatterNum}
compareValue={this.compareWeekMatterNum}/>
<RatePanel name="日环比" standardValue={this.standardDayMatterNum}
<RatePanel name={Moon.t("dashboard.dayRate")} standardValue={this.standardDayMatterNum}
compareValue={this.compareDayMatterNum}/>
</div>
</div>
<div className="lower">
:{dashboard.matterNum}
{Moon.t("dashboard.yesterdayMatterNum")}:{dashboard.matterNum}
</div>
</div>
</Col>
@@ -321,17 +322,17 @@ export default class Index extends TankComponent<IProps, IState> {
<Col xs={24} sm={24} md={12} lg={6}>
<div className="text-block">
<div className="upper">
<div className="indicator"></div>
<div className="indicator">{Moon.t("dashboard.totalFileSize")}</div>
<div className="amount">{FileUtil.humanFileSize(dashboard.totalFileSize)}</div>
<div>
<RatePanel name="周环比" standardValue={this.standardWeekSize}
<RatePanel name={Moon.t("dashboard.weekRate")} standardValue={this.standardWeekSize}
compareValue={this.compareWeekSize}/>
<RatePanel name="日环比" standardValue={this.standardDaySize}
<RatePanel name={Moon.t("dashboard.dayRate")} standardValue={this.standardDaySize}
compareValue={this.compareDaySize}/>
</div>
</div>
<div className="lower">
:{FileUtil.humanFileSize(dashboard.fileSize)}
{Moon.t("dashboard.yesterdayMatterSize")}:{FileUtil.humanFileSize(dashboard.fileSize)}
</div>
</div>
</Col>
@@ -342,7 +343,7 @@ export default class Index extends TankComponent<IProps, IState> {
<div className="figure-block">
<div className="title">
15PV/UV
{Moon.t("dashboard.recentDayInvokeUV", 15)}
</div>
<figure>
<ReactEcharts
@@ -365,7 +366,7 @@ export default class Index extends TankComponent<IProps, IState> {
<div className="figure-block">
<div className="title">
TOP10
{Moon.t("dashboard.downloadMatterTop10")}
</div>
<div className="list-rank">
<ul>
@@ -392,7 +393,7 @@ export default class Index extends TankComponent<IProps, IState> {
<div className="figure-block">
<div className="title">
IP TOP10
{Moon.t("dashboard.activeIpTop10")}
</div>
<div className="list-rank">
<ul>
@@ -413,12 +414,11 @@ export default class Index extends TankComponent<IProps, IState> {
</Col>
</Row>
<div>
<Alert
message="温馨提示:本页面数据每日凌晨5点清洗一次"
message={Moon.t("dashboard.warnHint")}
type="warning"
/>
</div>
+2 -1
View File
@@ -5,6 +5,7 @@ import Preference from "../../common/model/preference/Preference";
import Moon from "../../common/model/global/Moon";
import DefaultLogoPng from '../../assets/image/logo.png';
import Cookies from "js-cookie";
import Sun from "../../common/model/global/Sun";
interface IProps {
@@ -34,7 +35,7 @@ export default class BottomLayout extends TankComponent <IProps, IState> {
}
Cookies.set('_lang', Moon.getSingleton().lang);
this.updateUI()
Sun.updateFrame()
}
render() {
-3
View File
@@ -60,9 +60,6 @@ export default class SideLayout extends TankComponent <IProps, IState> {
let preference: Preference = Moon.getSingleton().preference
let user: User = Moon.getSingleton().user
console.log("当前头像1", user.avatarUrl)
console.log("当前头像", user.getAvatarUrl())
return (
<div className={`layout-side ${Sun.getSingleton().showDrawer ? 'show-drawer' : ''}`}>
+17 -17
View File
@@ -64,7 +64,7 @@ export default class Edit extends TankComponent<IProps, IState> {
that.preference.assign(values)
that.preference.httpSave(function () {
MessageBoxUtil.success("修改成功!")
MessageBoxUtil.success(Moon.t("operationSuccess"))
Sun.updateFrame()
@@ -94,7 +94,7 @@ export default class Edit extends TankComponent<IProps, IState> {
return (
<div className="page-preference-edit">
<TankTitle name={'网站偏好编辑'}>
<TankTitle name={Moon.t("preference.editPreference")}>
</TankTitle>
<TankContentCard loading={preference.detailLoading}>
@@ -112,9 +112,9 @@ export default class Edit extends TankComponent<IProps, IState> {
>
<Form.Item
label="网站名称"
label={Moon.t("preference.websiteName")}
name="name"
rules={[{required: true, message: '请输入网站名称!'}]}
rules={[{required: true, message: Moon.t("preference.enterWebsiteName")}]}
>
<Input/>
</Form.Item>
@@ -134,64 +134,64 @@ export default class Edit extends TankComponent<IProps, IState> {
</Form.Item>
<Form.Item
label="版权信息"
label={Moon.t("preference.copyright")}
name="copyright"
>
<Input/>
</Form.Item>
<Form.Item
label="备案信息"
label={Moon.t("preference.extraInfo")}
name="record"
>
<Input/>
</Form.Item>
<Form.Item
label="office预览地址"
label={Moon.t("preference.officeUrl")}
name="officeUrl"
>
<Input/>
</Form.Item>
<Form.Item
label="zip最大数量限制"
label={Moon.t("preference.zipMaxNumLimit")}
name="downloadDirMaxNum"
rules={[{required: true, message: 'zip最大数量限制必填!'}]}
rules={[{required: true, message: Moon.t("preference.enterZipMaxNumLimit")}]}
>
<InputNumber min={-1} max={1000} className='w150'/>
</Form.Item>
<Form.Item label="zip大小限制(B)"
<Form.Item label={Moon.t("preference.zipMaxSizeLimit")}
required={true}
>
<Form.Item
name="downloadDirMaxSize"
rules={[{required: true, message: 'zip大小限制必填!'}]}
rules={[{required: true, message: Moon.t("preference.enterZipMaxSizeLimit")}]}
noStyle
>
<InputNumber min={-1} className='w150'/>
</Form.Item>
<span
className="pl10">
className="pl10"> {Moon.t("preference.current")}:
{(this.formRef && this.formRef.current) ?
FileUtil.humanFileSize(this.formRef.current.getFieldValue("downloadDirMaxSize"))
: FileUtil.humanFileSize(preference.defaultTotalSizeLimit)}
</span>
</Form.Item>
<Form.Item label="默认用户空间大小(B)"
<Form.Item label={Moon.t("preference.userDefaultSizeLimit")}
required={true}
>
<Form.Item
name="defaultTotalSizeLimit"
rules={[{required: true, message: '默认用户空间大小必填!'}]}
rules={[{required: true, message: Moon.t("preference.enterUserDefaultSizeLimit")}]}
noStyle
>
<InputNumber min={-1} className='w150'/>
</Form.Item>
<span
className="pl10">
className="pl10"> {Moon.t("preference.current")}:
{(this.formRef && this.formRef.current) ?
FileUtil.humanFileSize(this.formRef.current.getFieldValue("defaultTotalSizeLimit"))
: FileUtil.humanFileSize(preference.defaultTotalSizeLimit)}
@@ -199,7 +199,7 @@ export default class Edit extends TankComponent<IProps, IState> {
</Form.Item>
<Form.Item
label="开放注册"
label={Moon.t("preference.allowRegister")}
name="allowRegister"
required={true}
valuePropName="checked"
@@ -209,7 +209,7 @@ export default class Edit extends TankComponent<IProps, IState> {
<div className="text-right">
<Button type="primary" htmlType="submit" icon={<SaveOutlined/>}>
{Moon.t("save")}
</Button>
</div>
+13 -13
View File
@@ -56,18 +56,18 @@ export default class Index extends TankComponent<IProps, IState> {
return (
<div className="page-preference-index">
<TankTitle name={Moon.t("dashboard.recentDayInvokeUV")}>
<TankTitle name={Moon.t("layout.setting")}>
<Link to={'/preference/edit'}>
<Button type={"primary"} icon={<EditOutlined/>}></Button>
<Button type={"primary"} icon={<EditOutlined/>}>{Moon.t("edit")}</Button>
</Link>
</TankTitle>
<TankContentCard>
<InfoCell name={'网站名称'}>
<InfoCell name={Moon.t("preference.websiteName")}>
{this.preference.name}
</InfoCell>
<InfoCell name={'logo'}>
<InfoCell name={Moon.t("preference.logo")}>
{this.preference.logoUrl && (
<img src={this.preference.logoUrl} alt="logo"
className="img-logo" onClick={() => {
@@ -85,32 +85,32 @@ export default class Index extends TankComponent<IProps, IState> {
)}
</InfoCell>
<InfoCell name={'版权信息'}>
<InfoCell name={Moon.t("preference.copyright")}>
<span dangerouslySetInnerHTML={{__html: this.preference.copyright}}/>
</InfoCell>
<InfoCell name={'备案信息'}>
<InfoCell name={Moon.t("preference.extraInfo")}>
<span dangerouslySetInnerHTML={{__html: this.preference.record}}/>
</InfoCell>
<InfoCell name={'zip下载数量限制'}>
{this.preference.downloadDirMaxNum === -1 ? '无限制' : this.preference.downloadDirMaxNum}
<InfoCell name={Moon.t("preference.zipMaxNumLimit")}>
{this.preference.downloadDirMaxNum === -1 ? Moon.t("preference.noLimit") : this.preference.downloadDirMaxNum}
</InfoCell>
<InfoCell name={'zip下载大小限制'}>
<InfoCell name={Moon.t("preference.zipMaxSizeLimit")}>
{FileUtil.humanFileSize(this.preference.downloadDirMaxSize)}
</InfoCell>
<InfoCell name={'用户默认总大小限制'}>
<InfoCell name={Moon.t("preference.userDefaultSizeLimit")}>
{FileUtil.humanFileSize(this.preference.defaultTotalSizeLimit)}
</InfoCell>
<InfoCell name={'允许自主注册'}>
{this.preference.allowRegister ? '是' : '否'}
<InfoCell name={Moon.t("preference.allowRegister")}>
{this.preference.allowRegister ? Moon.t("yes") : Moon.t("no")}
</InfoCell>
<InfoCell name={'文档链接'}>
<InfoCell name={Moon.t("preference.docLink")}>
<a href={'https://tank-doc.eyeblue.cn/zh'} target="_blank">
https://tank-doc.eyeblue.cn/zh
</a>
+1 -1
View File
@@ -142,7 +142,7 @@ export default class Detail extends TankComponent <IProps, IState> {
<Link to={'/user/edit/' + currentUser.uuid}>
<Button className='ml10' type="primary" icon={<EditOutlined/>}>
{Moon.t("edit")}
</Button>
</Link>
+3 -2
View File
@@ -20,6 +20,7 @@ import {EditOutlined} from "@ant-design/icons/lib";
import MessageBoxUtil from "../../common/util/MessageBoxUtil";
import Color from "../../common/model/base/option/Color";
import TransfigurationModal from "./widget/TransfigurationModal";
import Moon from "../../common/model/global/Moon";
interface IProps extends RouteComponentProps {
@@ -163,9 +164,9 @@ export default class List extends TankComponent<IProps, IState> {
render: (text: any, record: User) => (
<span>
<Link title="编辑"
<Link title={Moon.t("edit")}
to={StringUtil.prePath(match.path) + '/edit/' + record.uuid}>
<Tooltip title="编辑">
<Tooltip title={Moon.t("edit")}>
<EditOutlined className="btn-action"/>
</Tooltip>
</Link>