Skip to content

Commit 3817eae

Browse files
authored
fix(i18n): replace hardcoded text with translation in file preview (#207)
1 parent 0e2e892 commit 3817eae

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

components/file-preview/file-preview-canvas.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ export const FilePreviewCanvas = () => {
334334
useFilePreviewStore();
335335
const { isDark } = useTheme();
336336
const pathname = usePathname();
337+
const t = useTranslations('filePreview');
337338

338339
// Auto-close preview when route changes (best practice for modal state management)
339340
useEffect(() => {
@@ -396,7 +397,7 @@ export const FilePreviewCanvas = () => {
396397
? 'text-stone-300 hover:bg-stone-700 hover:text-stone-200'
397398
: 'text-stone-600 hover:bg-stone-200 hover:text-stone-800'
398399
)}
399-
aria-label="Close preview"
400+
aria-label={t('closeButton')}
400401
>
401402
<XIcon className="h-5 w-5" />
402403
</button>

messages/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,7 @@
23382338
"retryButton": "Retry",
23392339
"dismissButton": "Dismiss",
23402340
"downloadButton": "Download File",
2341+
"closeButton": "Close preview",
23412342
"noFileSelected": "No file selected",
23422343
"previewNotSupported": "Preview not supported for this file type. You can download it to view the content.",
23432344
"textPreview": {

messages/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,7 @@
23382338
"retryButton": "重试",
23392339
"dismissButton": "关闭",
23402340
"downloadButton": "下载文件",
2341+
"closeButton": "关闭预览",
23412342
"noFileSelected": "未选择文件",
23422343
"previewNotSupported": "不支持预览此文件类型。您可以下载查看内容。",
23432344
"textPreview": {

0 commit comments

Comments
 (0)