From ce6685a27c1338fe53f79f5141cd515c4c597e51 Mon Sep 17 00:00:00 2001 From: Michael Lam Date: Sat, 9 May 2026 10:05:09 -0700 Subject: [PATCH] fix: translate hidden-files workspace label --- static/i18n.js | 14 ++++---- .../test_issue1793_file_tree_cruft_filter.py | 32 +++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/static/i18n.js b/static/i18n.js index 8b86a209..e7244307 100644 --- a/static/i18n.js +++ b/static/i18n.js @@ -1361,7 +1361,7 @@ const LOCALES = { terminal_error: 'ターミナルエラー', workspace_empty_no_path: 'ワークスペースが選択されていません。設定 → ワークスペースで選択してください。', workspace_empty_dir: 'このワークスペースは空です。', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: '隠しファイルを表示', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', @@ -2298,7 +2298,7 @@ const LOCALES = { settings_autosave_failed: 'Не удалось сохранить', settings_autosave_retry: 'Повторить', workspace_empty_dir: 'Это рабочее пространство пусто.', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: 'Показывать скрытые файлы', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', @@ -3279,7 +3279,7 @@ const LOCALES = { terminal_error: 'Error del terminal', workspace_empty_no_path: 'No hay espacio de trabajo seleccionado. Configure un espacio de trabajo en Ajustes \u2192 Workspace para explorar archivos.', workspace_empty_dir: 'Este espacio de trabajo está vacío.', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: 'Mostrar archivos ocultos', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', @@ -5200,7 +5200,7 @@ const LOCALES = { workspace_empty_no_path: '未选择工作区。请在 设置 → 工作区 中设置工作区以浏览文件。', workspace_empty_dir: '此工作区为空。', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: '显示隐藏文件', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', @@ -6119,7 +6119,7 @@ const LOCALES = { workspace_empty_no_path: '未選擇工作區。請在 設定 → 工作區 中設定工作區以瀏覽檔案。', workspace_empty_dir: '此工作區為空。', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: '顯示隱藏檔案', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', @@ -7203,7 +7203,7 @@ const LOCALES = { no_workspace: 'Nenhum workspace', workspace_empty_no_path: 'Nenhum workspace selecionado. Configure em Configurações → Workspace.', workspace_empty_dir: 'Este workspace está vazio.', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: 'Mostrar arquivos ocultos', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', @@ -8124,7 +8124,7 @@ const LOCALES = { terminal_error: '터미널 오류', workspace_empty_no_path: 'No workspace selected. Set a workspace in Settings \u2192 Workspace to browse files.', workspace_empty_dir: 'This workspace is empty.', - workspace_show_hidden_files: 'Show hidden files', + workspace_show_hidden_files: '숨김 파일 표시', workspace_show_hidden_files_desc: 'Include .DS_Store, .git, node_modules, and other hidden / system files in the file tree.', workspace_hidden_files_visible: 'hidden visible', workspace_hidden_files_visible_title: 'Hidden files are visible — click for options', diff --git a/tests/test_issue1793_file_tree_cruft_filter.py b/tests/test_issue1793_file_tree_cruft_filter.py index 8cc12f68..c920ba20 100644 --- a/tests/test_issue1793_file_tree_cruft_filter.py +++ b/tests/test_issue1793_file_tree_cruft_filter.py @@ -170,3 +170,35 @@ def test_new_i18n_keys_present_in_all_locales(): f"key {key!r} missing in some locales (expected {n_locales}, " f"got {I18N_JS.count(key)})" ) + + +# ── #1841 regression: exact non-English translations must be present ───── + + +def test_workspace_show_hidden_files_translations_are_not_english_fallback(): + """Each non-English locale must carry its own translated string for + workspace_show_hidden_files — not silently fall back to the English + "Show hidden files". Pin the exact expected translations so a + regression that replaces any of them with the English fallback is + caught immediately. + """ + expected = { + "es": "Mostrar archivos ocultos", + "ru": "Показывать скрытые файлы", + "zh": "显示隐藏文件", + "zh-Hant": "顯示隱藏檔案", + "pt": "Mostrar arquivos ocultos", + "ja": "隠しファイルを表示", + "ko": "숨김 파일 표시", + } + for locale, translation in expected.items(): + # Build a source-level needle: the locale block assigns the + # translated value on a line like + # workspace_show_hidden_files: 'Mostrar archivos ocultos', + # Matching the full assignment avoids false positives from + # unrelated strings that happen to contain the same words. + needle = f"workspace_show_hidden_files: '{translation}'" + assert needle in I18N_JS, ( + f"locale {locale!r}: expected translation needle {needle!r} " + f"not found in i18n.js — likely fell back to English" + )