Skip to content

Commit 92eb05b

Browse files
authored
feat: 新增 偏好设置 > 剪切板 > 操作按钮 国际化 (#875)
1 parent 446565c commit 92eb05b

File tree

6 files changed

+90
-20
lines changed

6 files changed

+90
-20
lines changed

src/locales/en-US.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,32 @@
4848
},
4949
"content_settings": {
5050
"title": "Clipboard Content",
51+
"button": {
52+
"custom_operation_button": "Custom"
53+
},
5154
"label": {
5255
"auto_paste": "Auto Paste",
5356
"auto_paste_single": "Single Click",
5457
"auto_paste_double": "Double Click",
5558
"image_ocr": "Image OCR",
5659
"copy_as_plain": "Copy as Plain Text",
57-
"paste_as_plain": "Paste as Plain Text"
60+
"paste_as_plain": "Paste as Plain Text",
61+
"operation_button": "Action Button",
62+
"custom_operation_button_title": "Custom Action Button",
63+
"operation_button_option": {
64+
"copy": "Copy",
65+
"paste_plain": "Paste as Plain Text",
66+
"notes": "Notes",
67+
"favorite": "Favorite",
68+
"delete": "Delete"
69+
}
5870
},
5971
"hints": {
6072
"auto_paste": "Quickly paste content to the input field when using the left mouse button",
6173
"image_ocr": "Note: Please be sure to download the",
6274
"copy_as_plain": "Rich text and HTML formats retain only plain text content when copied",
63-
"paste_as_plain": "Rich text and HTML formatting retains only plain text content when pasting"
75+
"paste_as_plain": "Rich text and HTML formatting retains only plain text content when pasting",
76+
"operation_button": "Customize icon buttons to operate on clipboard content"
6477
}
6578
}
6679
},

src/locales/ja-JP.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,32 @@
4848
},
4949
"content_settings": {
5050
"title": "その他の設定",
51+
"button": {
52+
"custom_operation_button": "カスタム"
53+
},
5154
"label": {
5255
"auto_paste": "自動ペースト",
5356
"auto_paste_single": "シングルクリック",
5457
"auto_paste_double": "ダブルクリック",
5558
"image_ocr": "画像OCR",
5659
"copy_as_plain": "プレーンテキストとしてコピー",
57-
"paste_as_plain": "プレーンテキストとして貼り付ける"
60+
"paste_as_plain": "プレーンテキストとして貼り付ける",
61+
"operation_button": "操作ボタン",
62+
"custom_operation_button_title": "カスタム操作ボタン",
63+
"operation_button_option": {
64+
"copy": "コピー",
65+
"paste_plain": "プレーンテキストとして貼り付け",
66+
"notes": "メモ",
67+
"favorite": "お気に入り",
68+
"delete": "削除"
69+
}
5870
},
5971
"hints": {
6072
"auto_paste": "左クリック時に、内容を素早く入力フィールドに貼り付けます",
6173
"image_ocr": "注意:ご使用前に必ずダウンロードしてください。",
6274
"copy_as_plain": "リッチテキストとHTML形式は、コピーしてもプレーンテキストの内容しか保持しない",
63-
"paste_as_plain": "リッチテキストとHTMLの書式設定は、貼り付け時にプレーンテキストの内容だけを保持する"
75+
"paste_as_plain": "リッチテキストとHTMLの書式設定は、貼り付け時にプレーンテキストの内容だけを保持する",
76+
"operation_button": "クリップボード内容を操作するためのアイコンボタンをカスタマイズします"
6477
}
6578
}
6679
},

src/locales/zh-CN.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,32 @@
4848
},
4949
"content_settings": {
5050
"title": "剪切板内容",
51+
"button": {
52+
"custom_operation_button": "自定义"
53+
},
5154
"label": {
5255
"auto_paste": "自动粘贴",
5356
"auto_paste_single": "单击",
5457
"auto_paste_double": "双击",
5558
"image_ocr": "图片OCR",
5659
"copy_as_plain": "复制为纯文本",
57-
"paste_as_plain": "粘贴为纯文本"
60+
"paste_as_plain": "粘贴为纯文本",
61+
"operation_button": "操作按钮",
62+
"custom_operation_button_title": "自定义操作按钮",
63+
"operation_button_option": {
64+
"copy": "复制",
65+
"paste_plain": "粘贴为纯文本",
66+
"notes": "备注",
67+
"favorite": "收藏",
68+
"delete": "删除"
69+
}
5870
},
5971
"hints": {
6072
"auto_paste": "鼠标左键操作时,快速粘贴内容至输入位置",
6173
"image_ocr": "注意:使用前请务必先下载",
6274
"copy_as_plain": "富文本和HTML格式在复制时仅保留纯文本内容",
63-
"paste_as_plain": "富文本和HTML格式在粘贴时仅保留纯文本内容"
75+
"paste_as_plain": "富文本和HTML格式在粘贴时仅保留纯文本内容",
76+
"operation_button": "自定义操作剪贴板内容的图标按钮"
6477
}
6578
}
6679
},

src/locales/zh-TW.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,32 @@
4848
},
4949
"content_settings": {
5050
"title": "剪貼簿內容",
51+
"button": {
52+
"custom_operation_button": "自定義"
53+
},
5154
"label": {
5255
"auto_paste": "自動貼上",
5356
"auto_paste_single": "單擊",
5457
"auto_paste_double": "雙擊",
5558
"image_ocr": "圖片OCR",
5659
"copy_as_plain": "複製為純文字",
57-
"paste_as_plain": "粘貼為純文字"
60+
"paste_as_plain": "粘貼為純文字",
61+
"operation_button": "操作按鈕",
62+
"custom_operation_button_title": "自定義操作按鈕",
63+
"operation_button_option": {
64+
"copy": "複製",
65+
"paste_plain": "貼上為純文本",
66+
"notes": "備註",
67+
"favorite": "收藏",
68+
"delete": "刪除"
69+
}
5870
},
5971
"hints": {
6072
"auto_paste": "當使用滑鼠左鍵時,快速將內容貼上到輸入位置",
6173
"image_ocr": "注意:使用前請務必先下載",
6274
"copy_as_plain": "富文字和HTML格式在複製時僅保留純文字內容",
63-
"paste_as_plain": "富文字和HTML格式在粘貼時僅保留純文字內容"
75+
"paste_as_plain": "富文字和HTML格式在粘貼時僅保留純文字內容",
76+
"operation_button": "自定義操作剪貼簿內容的圖示按鈕"
6477
}
6578
}
6679
},

src/pages/Clipboard/Panel/components/List/components/Item/components/Header/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const Header: FC<HeaderProps> = (props) => {
125125
onDoubleClick={(event) => event.stopPropagation()}
126126
>
127127
{operationButtons.map((item) => {
128-
const { key, icon, activeIcon } = item;
128+
const { key, icon, activeIcon, title } = item;
129129

130130
const isFavorite = key === "star" && favorite;
131131

@@ -134,6 +134,7 @@ const Header: FC<HeaderProps> = (props) => {
134134
key={key}
135135
hoverable
136136
name={isFavorite ? activeIcon : icon}
137+
title={t(title)}
137138
className={clsx({ "text-gold!": isFavorite })}
138139
onClick={(event) => handleClick(event, key)}
139140
/>

src/pages/Clipboard/Settings/components/OperationButton/index.tsx

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,41 @@ interface TransferData {
1515
export const transferData: TransferData[] = [
1616
{
1717
key: "copy",
18-
title: "复制",
18+
title:
19+
"preference.clipboard.content_settings.label.operation_button_option.copy",
1920
icon: "i-lucide:copy",
2021
},
2122
{
2223
key: "pastePlain",
23-
title: "粘贴为纯文本",
24+
title:
25+
"preference.clipboard.content_settings.label.operation_button_option.paste_plain",
2426
icon: "i-lucide:clipboard-paste",
2527
},
2628
{
2729
key: "note",
28-
title: "备注",
30+
title:
31+
"preference.clipboard.content_settings.label.operation_button_option.notes",
2932
icon: "i-lucide:clipboard-pen-line",
3033
},
3134
{
3235
key: "star",
33-
title: "收藏",
36+
title:
37+
"preference.clipboard.content_settings.label.operation_button_option.favorite",
3438
icon: "i-iconamoon:star",
3539
activeIcon: "i-iconamoon:star-fill",
3640
},
3741
{
3842
key: "delete",
39-
title: "删除",
43+
title:
44+
"preference.clipboard.content_settings.label.operation_button_option.delete",
4045
icon: "i-lucide:trash",
4146
},
4247
];
4348

4449
const OperationButton = () => {
4550
const { content } = useSnapshot(clipboardStore);
4651
const [open, { toggle }] = useBoolean();
52+
const { t } = useTranslation();
4753

4854
const treeData = useCreation(() => {
4955
return content.operationButtons.map((key) => {
@@ -71,9 +77,9 @@ const OperationButton = () => {
7177
const { key, icon, title } = data;
7278

7379
return (
74-
<Flex key={key} align="center" gap={4}>
80+
<Flex key={key} align="center" gap={4} className="max-w-125">
7581
<Icon name={icon} />
76-
<span>{title}</span>
82+
<span className="truncate">{t(title)}</span>
7783
</Flex>
7884
);
7985
};
@@ -106,16 +112,27 @@ const OperationButton = () => {
106112
return (
107113
<>
108114
<ProListItem
109-
title="操作按钮"
110-
description="自定义操作剪贴板内容的图标按钮"
115+
title={t(
116+
"preference.clipboard.content_settings.label.operation_button",
117+
)}
118+
description={t(
119+
"preference.clipboard.content_settings.hints.operation_button",
120+
)}
111121
>
112-
<Button onClick={toggle}>自定义</Button>
122+
<Button onClick={toggle}>
123+
{t(
124+
"preference.clipboard.content_settings.button.custom_operation_button",
125+
)}
126+
</Button>
113127
</ProListItem>
114128

115129
<Modal
116130
centered
131+
destroyOnClose
117132
open={open}
118-
title="自定义操作按钮"
133+
title={t(
134+
"preference.clipboard.content_settings.label.custom_operation_button_title",
135+
)}
119136
width={448}
120137
footer={null}
121138
onCancel={toggle}

0 commit comments

Comments
 (0)