Skip to content

Commit 86ed610

Browse files
committed
feat: update translations
1 parent 125b74d commit 86ed610

File tree

3 files changed

+46
-12
lines changed

3 files changed

+46
-12
lines changed

src/i18n/en/translation.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@
9191
},
9292
"traffic": {
9393
"start_time": "Start time",
94-
"uptime": "Uptime"
94+
"uptime": "Uptime",
95+
"total": "Total",
96+
"traffic": "Traffic",
97+
"upload": "Upload",
98+
"download": "Download",
99+
"current_speed": "Current speed",
100+
"maximum_speed": "Maximum speed",
101+
"tcp_summary": "TCP summary",
102+
"avg_rtt": "Avg. RTT"
95103
},
96104
"scripting": {
97105
"run_script_button_title": "Run",

src/i18n/zh/translation.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,15 @@
9191
},
9292
"traffic": {
9393
"start_time": "开启时间",
94-
"uptime": "运行时长"
94+
"uptime": "运行时长",
95+
"total": "总计",
96+
"traffic": "流量",
97+
"upload": "上传",
98+
"download": "下载",
99+
"current_speed": "当前速度",
100+
"maximum_speed": "最高速度",
101+
"tcp_summary": "TCP 统计",
102+
"avg_rtt": "平均 RTT"
95103
},
96104
"scripting": {
97105
"run_script_button_title": "运行",

src/pages/Traffic/components/TrafficDataRow.tsx

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { jsx } from '@emotion/core'
33
import styled from '@emotion/styled/macro'
44
import css from '@emotion/css/macro'
55
import bytes from 'bytes'
6+
import { useTranslation } from 'react-i18next'
67
import tw from 'twin.macro'
78
import React, { useMemo, useState } from 'react'
89
import { ChevronRight } from '@sumup/icons'
@@ -17,6 +18,7 @@ interface TrafficDataRowProps {
1718
}
1819

1920
const TrafficDataRow: React.FC<TrafficDataRowProps> = ({ name, data }) => {
21+
const { t } = useTranslation()
2022
const [isDetailsOpen, setIsDetailsOpen] = useState<boolean>(false)
2123
const tcpStat = useMemo(() => {
2224
if (!data.statistics || !data.statistics.length) return
@@ -44,7 +46,9 @@ const TrafficDataRow: React.FC<TrafficDataRowProps> = ({ name, data }) => {
4446
<DataRowMain>
4547
<div tw="truncate flex-1 text-sm lg:text-base">{name}</div>
4648
<div tw="flex items-center ml-3 text-sm lg:text-base">
47-
<div>总计 {bytes(data.in + data.out)}</div>
49+
<div>
50+
{t('traffic.total')} {bytes(data.in + data.out)}
51+
</div>
4852
<ChevronRight
4953
css={[
5054
tw`ml-2 w-5 h-5 transition-transform duration-200 ease-in-out`,
@@ -53,31 +57,45 @@ const TrafficDataRow: React.FC<TrafficDataRowProps> = ({ name, data }) => {
5357
/>
5458
</div>
5559
</DataRowMain>
60+
5661
<Collapse isOpened={isDetailsOpen}>
5762
<div tw="pb-3">
5863
<DataRowSub>
59-
<div>流量</div>
64+
<div>{t('traffic.traffic')}</div>
6065
<div>
61-
上传: {bytes(data.out)} 下载: {bytes(data.in)}
66+
<span>{`${t('traffic.upload')}: ${bytes(data.out)}`}</span>
67+
<span> </span>
68+
<span>{`${t('traffic.download')}: ${bytes(data.in)}`}</span>
6269
</div>
6370
</DataRowSub>
6471
<DataRowSub>
65-
<div>当前速度</div>
72+
<div>{t('traffic.current_speed')}</div>
6673
<div>
67-
上传: {bytes(data.outCurrentSpeed)}/s 下载:{' '}
68-
{bytes(data.inCurrentSpeed)}/s
74+
<span>{`${t('traffic.upload')}: ${bytes(
75+
data.outCurrentSpeed,
76+
)}/s`}</span>
77+
<span> </span>
78+
<span>{`${t('traffic.download')}: ${bytes(
79+
data.inCurrentSpeed,
80+
)}/s`}</span>
6981
</div>
7082
</DataRowSub>
7183
<DataRowSub>
72-
<div>最高速度</div>
84+
<div>{t('traffic.maximum_speed')}</div>
7385
<div>
74-
上传: {bytes(data.outMaxSpeed)}/s 下载: {bytes(data.inMaxSpeed)}/s
86+
<span>{`${t('traffic.upload')}: ${bytes(
87+
data.outMaxSpeed,
88+
)}/s`}</span>
89+
<span> </span>
90+
<span>{`${t('traffic.download')}: ${bytes(
91+
data.inMaxSpeed,
92+
)}/s`}</span>
7593
</div>
7694
</DataRowSub>
7795
{!!tcpStat && (
7896
<DataRowSub>
79-
<div>TCP 统计</div>
80-
<div>Avg. RTT {tcpStat}ms</div>
97+
<div>{t('traffic.tcp_summary')}</div>
98+
<div>{`${t('traffic.avg_rtt')} ${tcpStat}ms`}</div>
8199
</DataRowSub>
82100
)}
83101
</div>

0 commit comments

Comments
 (0)