Skip to content

Commit fe3b78f

Browse files
committed
chore: update i18n
1 parent 0fd5442 commit fe3b78f

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed

frontend/locales/en.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"operating-system": "Operating System"
3232
},
3333
"shortcut": {
34+
"visits": "{{count}} visits",
3435
"visibility": {
3536
"private": {
3637
"self": "Private",
@@ -46,6 +47,13 @@
4647
}
4748
}
4849
},
50+
"filter": {
51+
"all": "All",
52+
"mine": "Mine",
53+
"compact-mode": "Compact mode",
54+
"order-by": "Order by",
55+
"direction": "Direction"
56+
},
4957
"user": {
5058
"self": "User",
5159
"nickname": "Nickname",

frontend/locales/zh.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"operating-system": "操作系统"
3232
},
3333
"shortcut": {
34+
"visits": "{{count}} 次访问",
3435
"visibility": {
3536
"private": {
3637
"self": "私有的",
@@ -46,6 +47,13 @@
4647
}
4748
}
4849
},
50+
"filter": {
51+
"all": "所有",
52+
"mine": "我的",
53+
"compact-mode": "紧凑模式",
54+
"order-by": "排序方式",
55+
"direction": "方向"
56+
},
4957
"user": {
5058
"self": "用户",
5159
"nickname": "昵称",

frontend/web/src/components/EditUserinfoDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ const EditUserinfoDialog: React.FC<Props> = (props: Props) => {
6666
</div>
6767
<div>
6868
<div className="w-full flex flex-col justify-start items-start mb-3">
69-
<span className="mb-2">Email</span>
69+
<span className="mb-2">{t("common.email")}</span>
7070
<Input className="w-full" type="text" value={email} onChange={handleEmailChanged} />
7171
</div>
7272
<div className="w-full flex flex-col justify-start items-start mb-3">
73-
<span className="mb-2">Nickname</span>
73+
<span className="mb-2">{t("user.nickname")}</span>
7474
<Input className="w-full" type="text" value={nickname} onChange={handleNicknameChanged} />
7575
</div>
7676
<div className="w-full flex flex-row justify-end items-center space-x-2">

frontend/web/src/components/Navigator.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import classNames from "classnames";
2+
import { useTranslation } from "react-i18next";
23
import { useAppSelector } from "../stores";
34
import useViewStore from "../stores/v1/view";
45
import Icon from "./Icon";
56

67
const Navigator = () => {
8+
const { t } = useTranslation();
79
const viewStore = useViewStore();
810
const { shortcutList } = useAppSelector((state) => state.shortcut);
911
const tags = shortcutList.map((shortcut) => shortcut.tags).flat();
@@ -22,7 +24,7 @@ const Navigator = () => {
2224
onClick={() => viewStore.setFilter({ tab: "tab:all" })}
2325
>
2426
<Icon.CircleSlash className="w-4 h-auto mr-1" />
25-
<span className="font-normal">All</span>
27+
<span className="font-normal">{t("filter.all")}</span>
2628
</button>
2729
<button
2830
className={classNames(
@@ -34,7 +36,7 @@ const Navigator = () => {
3436
onClick={() => viewStore.setFilter({ tab: "tab:mine" })}
3537
>
3638
<Icon.User className="w-4 h-auto mr-1" />
37-
<span className="font-normal">Mine</span>
39+
<span className="font-normal">{t("filter.mine")}</span>
3840
</button>
3941
{Array.from(sortedTagMap.keys()).map((tag) => (
4042
<button

frontend/web/src/components/ShortcutCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const ShortcutView = (props: Props) => {
124124
className="w-auto px-2 leading-6 flex flex-row justify-start items-center flex-nowrap whitespace-nowrap border rounded-full cursor-pointer text-gray-500 text-sm dark:border-zinc-800"
125125
>
126126
<Icon.BarChart2 className="w-4 h-auto mr-1" />
127-
{shortcut.view} visits
127+
{t("shortcut.visits", { count: shortcut.view })}
128128
</Link>
129129
</Tooltip>
130130
</div>

frontend/web/src/components/ViewSetting.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { Divider, Option, Select, Switch } from "@mui/joy";
2+
import { useTranslation } from "react-i18next";
23
import useViewStore from "../stores/v1/view";
34
import Icon from "./Icon";
45
import Dropdown from "./common/Dropdown";
56

67
const ViewSetting = () => {
8+
const { t } = useTranslation();
79
const viewStore = useViewStore();
810
const order = viewStore.getOrder();
911
const { field, direction } = order;
@@ -20,7 +22,7 @@ const ViewSetting = () => {
2022
actions={
2123
<div className="w-52 p-2 gap-2 flex flex-col justify-start items-start" onClick={(e) => e.stopPropagation()}>
2224
<div className="w-full flex flex-row justify-between items-center">
23-
<span className="text-sm shrink-0 mr-2">Compact mode</span>
25+
<span className="text-sm shrink-0 mr-2">{t("filter.compact-mode")}</span>
2426
<Switch
2527
size="sm"
2628
checked={displayStyle === "compact"}
@@ -29,7 +31,7 @@ const ViewSetting = () => {
2931
</div>
3032
<Divider className="!my-1" />
3133
<div className="w-full flex flex-row justify-between items-center">
32-
<span className="text-sm shrink-0 mr-2">Order by</span>
34+
<span className="text-sm shrink-0 mr-2">{t("filter.order-by")}</span>
3335
<Select size="sm" value={field} onChange={(_, value) => viewStore.setOrder({ field: value as any })}>
3436
<Option value={"name"}>Name</Option>
3537
<Option value={"updatedTs"}>CreatedAt</Option>
@@ -38,7 +40,7 @@ const ViewSetting = () => {
3840
</Select>
3941
</div>
4042
<div className="w-full flex flex-row justify-between items-center">
41-
<span className="text-sm shrink-0 mr-2">Direction</span>
43+
<span className="text-sm shrink-0 mr-2">{t("filter.direction")}</span>
4244
<Select size="sm" value={direction} onChange={(_, value) => viewStore.setOrder({ direction: value as any })}>
4345
<Option value={"asc"}>ASC</Option>
4446
<Option value={"desc"}>DESC</Option>

0 commit comments

Comments
 (0)