From e76954b86a84e421b57cd3edca7974b93c6b1863 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 18:41:21 +0200 Subject: [PATCH 01/13] Add Czech translations for recent Backtalk strings --- .../values-cs/strings_backtalk_20261015.xml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 talkback/src/main/res/values-cs/strings_backtalk_20261015.xml diff --git a/talkback/src/main/res/values-cs/strings_backtalk_20261015.xml b/talkback/src/main/res/values-cs/strings_backtalk_20261015.xml new file mode 100644 index 00000000..7654b69f --- /dev/null +++ b/talkback/src/main/res/values-cs/strings_backtalk_20261015.xml @@ -0,0 +1,32 @@ + + + + + + Zdroje skriptů + Nebyly přidány žádné zdroje + Přidat zdroj + Přidat + github.com/owner/repository + Nejde o adresu repozitáře na GitHubu, GitLabu, Codebergu, Gitea ani Bitbucketu. + Tento zdroj už je přidán. + Načítání + V tomto zdroji nejsou žádné skripty + Skripty se nepodařilo načíst. %1$s + Zkusit znovu + Stahování %1$s + Odstranit zdroj + Odstranit %1$s? + Skripty nainstalované z tohoto zdroje zůstanou nainstalované. + + + Zrušit výběr + + + požádat o použití jako braillský řádek pro Backtalk + Umožní aplikaci požádat, aby mohla sloužit jako braillský řádek pro Backtalk. Pokud ji v Backtalku povolíte, může číst vše na obrazovce a ovládat zařízení. Backtalk se vás nejprve zeptá. + + + Optimalizace baterie může Backtalk zastavit + V tomto telefonu může spořič baterie po vypnutí obrazovky Backtalk zastavit, takže přestane mluvit, dokud nebude znovu spuštěn. Klepnutím otevřete optimalizaci baterie, zvolte Všechny aplikace, najděte Backtalk a vyberte Neoptimalizovat. + From 699d28df8dbc11ebedef0d6dff68a6239883aec1 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 18:41:30 +0200 Subject: [PATCH 02/13] Translate external braille display strings to Czech --- .../res/values-cs/strings_backtalk_20261015.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 braille/brailledisplay/src/phone/res/values-cs/strings_backtalk_20261015.xml diff --git a/braille/brailledisplay/src/phone/res/values-cs/strings_backtalk_20261015.xml b/braille/brailledisplay/src/phone/res/values-cs/strings_backtalk_20261015.xml new file mode 100644 index 00000000..3fc79b26 --- /dev/null +++ b/braille/brailledisplay/src/phone/res/values-cs/strings_backtalk_20261015.xml @@ -0,0 +1,15 @@ + + + + Braillské řádky z jiných aplikací + Povolit aplikaci %1$s, aby sloužila jako braillský řádek pro Backtalk? + Backtalk ji nezačne používat, dokud ji nepovolíte. + %1$s bude moci číst vše, co Backtalk zobrazuje v braillu, tedy cokoli na obrazovce včetně zpráv a toho, co píšete. Bude také moci ovládat vaše zařízení stejně jako braillský řádek: psát, otevírat aplikace a spouštět libovolné příkazy Backtalku. Povolujte pouze aplikace, kterým důvěřujete. + Povolit + Nepovolit + %1$s je váš braillský řádek + Dokud Backtalk tuto aplikaci používá, %1$s může číst obsah obrazovky a ovládat zařízení. + Braillské řádky z jiných aplikací + Aplikace, které povolíte, mohou pro Backtalk sloužit jako braillské řádky. Aplikace sloužící jako braillský řádek může číst obsah obrazovky a ovládat zařízení. + Žádné aplikace nemohou sloužit jako braillské řádky. + From 59658fe4bd730a334b1c99d2b40ab9a061efa914 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:08:23 +0200 Subject: [PATCH 03/13] Add one-shot Czech lint baseline refresher --- .../workflows/refresh-czech-lint-baseline.yml | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/refresh-czech-lint-baseline.yml diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml new file mode 100644 index 00000000..a40891ca --- /dev/null +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -0,0 +1,107 @@ +name: Refresh Czech lint baseline + +on: + push: + branches: [ "czech-translation" ] + +permissions: + contents: write + +jobs: + refresh: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Refresh Czech MissingTranslation baseline entries + shell: python + run: | + from pathlib import Path + + keys = [ + "battery_optimization_notification_title", + "battery_optimization_notification_text", + "deselection_mode", + "braille_display_permission_instructions_message", + "braille_display_permission_instructions_title", + "pref_braille_displays_from_apps", + "pref_braille_displays_from_apps_description", + "pref_external_display_channel_list", + "external_display_channel_list_primary", + "external_display_channel_list_secondary", + "pref_external_display_channel_other", + "pref_external_display_channel_other_description", + "pref_braille_display_mirror", + "pref_braille_display_mirror_description", + "pref_braille_display_select_package", + "pref_braille_display_select_package_description", + "pref_braille_display_selected_package", + "script_sources", + "script_sources_none", + "script_sources_description", + "script_sources_add", + "script_sources_edit", + "script_sources_delete", + "script_sources_change_name", + "script_sources_set_url", + "script_sources_name_empty", + "script_sources_url_empty", + "script_sources_invalid_url", + "script_sources_download_failure", + "script_sources_download_success", + "script_sources_reset", + ] + + path = Path("lint-baseline.xml") + text = path.read_text(encoding="utf-8") + token = ""cs" (Czech)" + changed = 0 + + for key in keys: + marker = f'message=""{key}" is not translated' + count = text.count(marker) + if count != 1: + raise SystemExit(f"{key}: expected exactly one baseline message, found {count}") + + pos = text.find(marker) + start = text.rfind("", pos) + if start < 0 or end < 0: + raise SystemExit(f"{key}: issue block not found") + end += len("") + + block = text[start:end] + token_count = block.count(token) + if token_count != 1: + raise SystemExit(f"{key}: expected Czech locale exactly once, found {token_count}") + + if f", {token}" in block: + block2 = block.replace(f", {token}", "", 1) + elif f"{token}, " in block: + block2 = block.replace(f"{token}, ", "", 1) + else: + raise SystemExit(f"{key}: unexpected Czech locale placement") + + text = text[:start] + block2 + text[end:] + changed += 1 + + if changed != 31: + raise SystemExit(f"Expected 31 baseline updates, got {changed}") + + path.write_text(text, encoding="utf-8") + print(f"Updated {changed} MissingTranslation baseline entries") + + - name: Validate patch and remove helper workflow + run: | + git diff --check + rm .github/workflows/refresh-czech-lint-baseline.yml + git status --short + + - name: Commit refreshed baseline + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git diff --cached --check + git commit -m "Refresh Czech MissingTranslation lint baseline" + git push From 85bb5821e5485f835643ce93d523eb36d0ee1b52 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:08:42 +0200 Subject: [PATCH 04/13] Trigger Czech lint baseline refresh --- .ci-trigger | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ci-trigger diff --git a/.ci-trigger b/.ci-trigger new file mode 100644 index 00000000..0401cc2c --- /dev/null +++ b/.ci-trigger @@ -0,0 +1 @@ +Trigger the one-shot Czech lint baseline refresh workflow. From 3815cf655e8198c6f29d8981efbafc1c65c98687 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:12:47 +0200 Subject: [PATCH 05/13] Trigger validation baseline refresh --- .ci-trigger | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci-trigger b/.ci-trigger index 0401cc2c..9dc49d7c 100644 --- a/.ci-trigger +++ b/.ci-trigger @@ -1 +1 @@ -Trigger the one-shot Czech lint baseline refresh workflow. +Trigger Czech baseline refresh from the validation pull request. From f616d1d7e1b80184abb648d010034e7061a58e1f Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:13:24 +0200 Subject: [PATCH 06/13] Trigger refreshed validation workflow --- .ci-trigger | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci-trigger b/.ci-trigger index 9dc49d7c..18fea524 100644 --- a/.ci-trigger +++ b/.ci-trigger @@ -1 +1 @@ -Trigger Czech baseline refresh from the validation pull request. +Trigger refreshed Czech baseline validation workflow. From 1db6fc3ba5635648a05486b179c30d4afe20ed16 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:14:32 +0200 Subject: [PATCH 07/13] Use exact lint-reported Czech baseline keys --- .../workflows/refresh-czech-lint-baseline.yml | 66 +++++++++---------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml index a40891ca..d539ad23 100644 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Refresh Czech MissingTranslation baseline entries + - name: Refresh exact Czech MissingTranslation baseline entries shell: python run: | from pathlib import Path @@ -21,35 +21,35 @@ jobs: keys = [ "battery_optimization_notification_title", "battery_optimization_notification_text", - "deselection_mode", - "braille_display_permission_instructions_message", - "braille_display_permission_instructions_title", - "pref_braille_displays_from_apps", - "pref_braille_displays_from_apps_description", - "pref_external_display_channel_list", - "external_display_channel_list_primary", - "external_display_channel_list_secondary", - "pref_external_display_channel_other", - "pref_external_display_channel_other_description", - "pref_braille_display_mirror", - "pref_braille_display_mirror_description", - "pref_braille_display_select_package", - "pref_braille_display_select_package_description", - "pref_braille_display_selected_package", + "permission_braille_display_label", + "permission_braille_display_description", + "external_display_channel", + "external_display_ask_title", + "external_display_ask_text", + "external_display_warning", + "external_display_allow", + "external_display_deny", + "external_display_in_use_title", + "external_display_in_use_text", + "external_displays_title", + "external_displays_summary", + "external_displays_none", + "title_clear_selection", "script_sources", "script_sources_none", - "script_sources_description", - "script_sources_add", - "script_sources_edit", - "script_sources_delete", - "script_sources_change_name", - "script_sources_set_url", - "script_sources_name_empty", - "script_sources_url_empty", - "script_sources_invalid_url", - "script_sources_download_failure", - "script_sources_download_success", - "script_sources_reset", + "script_source_add", + "script_source_add_button", + "script_source_hint", + "script_source_invalid", + "script_source_exists", + "script_source_loading", + "script_source_empty", + "script_source_failed", + "script_source_retry", + "script_source_downloading", + "script_source_remove", + "script_source_remove_title", + "script_source_remove_message", ] path = Path("lint-baseline.xml") @@ -62,39 +62,35 @@ jobs: count = text.count(marker) if count != 1: raise SystemExit(f"{key}: expected exactly one baseline message, found {count}") - pos = text.find(marker) start = text.rfind("", pos) if start < 0 or end < 0: raise SystemExit(f"{key}: issue block not found") end += len("") - block = text[start:end] token_count = block.count(token) if token_count != 1: raise SystemExit(f"{key}: expected Czech locale exactly once, found {token_count}") - if f", {token}" in block: block2 = block.replace(f", {token}", "", 1) elif f"{token}, " in block: block2 = block.replace(f"{token}, ", "", 1) else: raise SystemExit(f"{key}: unexpected Czech locale placement") - text = text[:start] + block2 + text[end:] changed += 1 if changed != 31: raise SystemExit(f"Expected 31 baseline updates, got {changed}") - path.write_text(text, encoding="utf-8") - print(f"Updated {changed} MissingTranslation baseline entries") + print(f"Updated {changed} exact MissingTranslation baseline entries") - - name: Validate patch and remove helper workflow + - name: Validate patch and remove temporary files run: | git diff --check rm .github/workflows/refresh-czech-lint-baseline.yml + rm -f .ci-trigger git status --short - name: Commit refreshed baseline From dc2b1ee410c91efd1b0d8c514fbfd64f4690f25b Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:15:42 +0200 Subject: [PATCH 08/13] Match Czech lint baseline entries by key and source file --- .../workflows/refresh-czech-lint-baseline.yml | 86 +++++++++---------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml index d539ad23..f837642c 100644 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -17,39 +17,40 @@ jobs: shell: python run: | from pathlib import Path + import re - keys = [ - "battery_optimization_notification_title", - "battery_optimization_notification_text", - "permission_braille_display_label", - "permission_braille_display_description", - "external_display_channel", - "external_display_ask_title", - "external_display_ask_text", - "external_display_warning", - "external_display_allow", - "external_display_deny", - "external_display_in_use_title", - "external_display_in_use_text", - "external_displays_title", - "external_displays_summary", - "external_displays_none", - "title_clear_selection", - "script_sources", - "script_sources_none", - "script_source_add", - "script_source_add_button", - "script_source_hint", - "script_source_invalid", - "script_source_exists", - "script_source_loading", - "script_source_empty", - "script_source_failed", - "script_source_retry", - "script_source_downloading", - "script_source_remove", - "script_source_remove_title", - "script_source_remove_message", + entries = [ + ("battery_optimization_notification_title", "talkback/src/main/res/values/strings.xml"), + ("battery_optimization_notification_text", "talkback/src/main/res/values/strings.xml"), + ("permission_braille_display_label", "talkback/src/main/res/values/strings.xml"), + ("permission_braille_display_description", "talkback/src/main/res/values/strings.xml"), + ("external_display_channel", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_ask_title", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_ask_text", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_warning", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_allow", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_deny", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_in_use_title", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_display_in_use_text", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_displays_title", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_displays_summary", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("external_displays_none", "braille/brailledisplay/src/phone/res/values/strings.xml"), + ("title_clear_selection", "talkback/src/main/res/values/strings.xml"), + ("script_sources", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_sources_none", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_add", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_add_button", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_hint", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_invalid", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_exists", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_loading", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_empty", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_failed", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_retry", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_downloading", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_remove", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_remove_title", "talkback/src/main/res/values/strings_scripts.xml"), + ("script_source_remove_message", "talkback/src/main/res/values/strings_scripts.xml"), ] path = Path("lint-baseline.xml") @@ -57,18 +58,13 @@ jobs: token = ""cs" (Czech)" changed = 0 - for key in keys: + for key, source in entries: marker = f'message=""{key}" is not translated' - count = text.count(marker) - if count != 1: - raise SystemExit(f"{key}: expected exactly one baseline message, found {count}") - pos = text.find(marker) - start = text.rfind("", pos) - if start < 0 or end < 0: - raise SystemExit(f"{key}: issue block not found") - end += len("") - block = text[start:end] + blocks = re.findall(r'', text, flags=re.S) + candidates = [b for b in blocks if marker in b and source in b] + if len(candidates) != 1: + raise SystemExit(f"{key} / {source}: expected exactly one matching baseline block, found {len(candidates)}") + block = candidates[0] token_count = block.count(token) if token_count != 1: raise SystemExit(f"{key}: expected Czech locale exactly once, found {token_count}") @@ -78,7 +74,9 @@ jobs: block2 = block.replace(f"{token}, ", "", 1) else: raise SystemExit(f"{key}: unexpected Czech locale placement") - text = text[:start] + block2 + text[end:] + if text.count(block) != 1: + raise SystemExit(f"{key}: selected issue block is not unique in baseline") + text = text.replace(block, block2, 1) changed += 1 if changed != 31: From 1e8a4201494d09690d529641f5aaea767dfb7a8b Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:55:53 +0200 Subject: [PATCH 09/13] Refresh Czech lint baseline using exact lint locations --- .../workflows/refresh-czech-lint-baseline.yml | 112 +++++++++++------- 1 file changed, 67 insertions(+), 45 deletions(-) diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml index f837642c..6f6fb7e2 100644 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -19,79 +19,101 @@ jobs: from pathlib import Path import re + # Exact locations copied from the current lint-results-phoneDebug report. entries = [ - ("battery_optimization_notification_title", "talkback/src/main/res/values/strings.xml"), - ("battery_optimization_notification_text", "talkback/src/main/res/values/strings.xml"), - ("permission_braille_display_label", "talkback/src/main/res/values/strings.xml"), - ("permission_braille_display_description", "talkback/src/main/res/values/strings.xml"), - ("external_display_channel", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_ask_title", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_ask_text", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_warning", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_allow", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_deny", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_in_use_title", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_display_in_use_text", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_displays_title", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_displays_summary", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("external_displays_none", "braille/brailledisplay/src/phone/res/values/strings.xml"), - ("title_clear_selection", "talkback/src/main/res/values/strings.xml"), - ("script_sources", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_sources_none", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_add", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_add_button", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_hint", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_invalid", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_exists", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_loading", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_empty", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_failed", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_retry", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_downloading", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_remove", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_remove_title", "talkback/src/main/res/values/strings_scripts.xml"), - ("script_source_remove_message", "talkback/src/main/res/values/strings_scripts.xml"), + ("battery_optimization_notification_title", "talkback/src/main/res/values/strings.xml", 177), + ("battery_optimization_notification_text", "talkback/src/main/res/values/strings.xml", 179), + ("permission_braille_display_label", "talkback/src/main/res/values/strings.xml", 870), + ("permission_braille_display_description", "talkback/src/main/res/values/strings.xml", 872), + ("external_display_channel", "braille/brailledisplay/src/phone/res/values/strings.xml", 68), + ("external_display_ask_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 72), + ("external_display_ask_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 74), + ("external_display_warning", "braille/brailledisplay/src/phone/res/values/strings.xml", 79), + ("external_display_allow", "braille/brailledisplay/src/phone/res/values/strings.xml", 81), + ("external_display_deny", "braille/brailledisplay/src/phone/res/values/strings.xml", 83), + ("external_display_in_use_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 86), + ("external_display_in_use_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 88), + ("external_displays_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 90), + ("external_displays_summary", "braille/brailledisplay/src/phone/res/values/strings.xml", 92), + ("external_displays_none", "braille/brailledisplay/src/phone/res/values/strings.xml", 94), + ("title_clear_selection", "talkback/src/main/res/values/strings.xml", 471), + ("script_sources", "talkback/src/main/res/values/strings_scripts.xml", 256), + ("script_sources_none", "talkback/src/main/res/values/strings_scripts.xml", 258), + ("script_source_add", "talkback/src/main/res/values/strings_scripts.xml", 260), + ("script_source_add_button", "talkback/src/main/res/values/strings_scripts.xml", 262), + ("script_source_hint", "talkback/src/main/res/values/strings_scripts.xml", 264), + ("script_source_invalid", "talkback/src/main/res/values/strings_scripts.xml", 266), + ("script_source_exists", "talkback/src/main/res/values/strings_scripts.xml", 268), + ("script_source_loading", "talkback/src/main/res/values/strings_scripts.xml", 270), + ("script_source_empty", "talkback/src/main/res/values/strings_scripts.xml", 272), + ("script_source_failed", "talkback/src/main/res/values/strings_scripts.xml", 274), + ("script_source_retry", "talkback/src/main/res/values/strings_scripts.xml", 276), + ("script_source_downloading", "talkback/src/main/res/values/strings_scripts.xml", 278), + ("script_source_remove", "talkback/src/main/res/values/strings_scripts.xml", 280), + ("script_source_remove_title", "talkback/src/main/res/values/strings_scripts.xml", 282), + ("script_source_remove_message", "talkback/src/main/res/values/strings_scripts.xml", 284), ] path = Path("lint-baseline.xml") text = path.read_text(encoding="utf-8") token = ""cs" (Czech)" + blocks = re.findall(r'', text, flags=re.S) changed = 0 - for key, source in entries: + for key, source, line in entries: marker = f'message=""{key}" is not translated' - blocks = re.findall(r'', text, flags=re.S) - candidates = [b for b in blocks if marker in b and source in b] + file_marker = f'file="{source}"' + line_marker = f'line="{line}"' + candidates = [ + b for b in blocks + if marker in b and file_marker in b and line_marker in b + ] if len(candidates) != 1: - raise SystemExit(f"{key} / {source}: expected exactly one matching baseline block, found {len(candidates)}") + same_key = [b for b in blocks if marker in b] + locations = [] + for b in same_key: + locations.extend(re.findall(r']*/>', b)) + raise SystemExit( + f"{key}: exact lint location {source}:{line} matched {len(candidates)} baseline blocks; " + f"baseline locations for this key: {locations}" + ) + block = candidates[0] - token_count = block.count(token) - if token_count != 1: - raise SystemExit(f"{key}: expected Czech locale exactly once, found {token_count}") + if block.count(token) != 1: + raise SystemExit( + f"{key} at {source}:{line}: expected Czech locale exactly once, " + f"found {block.count(token)}" + ) + if f", {token}" in block: block2 = block.replace(f", {token}", "", 1) elif f"{token}, " in block: block2 = block.replace(f"{token}, ", "", 1) else: - raise SystemExit(f"{key}: unexpected Czech locale placement") + raise SystemExit(f"{key} at {source}:{line}: unexpected Czech locale placement") + if text.count(block) != 1: - raise SystemExit(f"{key}: selected issue block is not unique in baseline") + raise SystemExit(f"{key} at {source}:{line}: selected baseline block is not unique") text = text.replace(block, block2, 1) + blocks[blocks.index(block)] = block2 changed += 1 if changed != 31: - raise SystemExit(f"Expected 31 baseline updates, got {changed}") + raise SystemExit(f"Expected exactly 31 baseline updates, got {changed}") + path.write_text(text, encoding="utf-8") - print(f"Updated {changed} exact MissingTranslation baseline entries") + print(f"Updated exactly {changed} MissingTranslation baseline entries using current lint locations") - - name: Validate patch and remove temporary files + - name: Validate and remove temporary validation files run: | git diff --check rm .github/workflows/refresh-czech-lint-baseline.yml rm -f .ci-trigger - git status --short + changed=$(git status --short | sed 's/^...//' | sort) + printf '%s\n' "$changed" + test "$changed" = "$(printf '%s\n' '.ci-trigger' '.github/workflows/refresh-czech-lint-baseline.yml' 'lint-baseline.xml' | sort)" - - name: Commit refreshed baseline + - name: Commit final baseline refresh run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" From 2cd836c11e45a125b12f5f5a0ce44ea40303f1ed Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:56:53 +0200 Subject: [PATCH 10/13] Diagnose exact Czech lint baseline locations --- .../workflows/refresh-czech-lint-baseline.yml | 145 ++++++------------ 1 file changed, 46 insertions(+), 99 deletions(-) diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml index 6f6fb7e2..9682fa01 100644 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -5,119 +5,66 @@ on: branches: [ "czech-translation" ] permissions: - contents: write + contents: read jobs: - refresh: + diagnose: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Refresh exact Czech MissingTranslation baseline entries + - name: Print exact baseline locations for Czech translation keys shell: python run: | from pathlib import Path import re - # Exact locations copied from the current lint-results-phoneDebug report. - entries = [ - ("battery_optimization_notification_title", "talkback/src/main/res/values/strings.xml", 177), - ("battery_optimization_notification_text", "talkback/src/main/res/values/strings.xml", 179), - ("permission_braille_display_label", "talkback/src/main/res/values/strings.xml", 870), - ("permission_braille_display_description", "talkback/src/main/res/values/strings.xml", 872), - ("external_display_channel", "braille/brailledisplay/src/phone/res/values/strings.xml", 68), - ("external_display_ask_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 72), - ("external_display_ask_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 74), - ("external_display_warning", "braille/brailledisplay/src/phone/res/values/strings.xml", 79), - ("external_display_allow", "braille/brailledisplay/src/phone/res/values/strings.xml", 81), - ("external_display_deny", "braille/brailledisplay/src/phone/res/values/strings.xml", 83), - ("external_display_in_use_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 86), - ("external_display_in_use_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 88), - ("external_displays_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 90), - ("external_displays_summary", "braille/brailledisplay/src/phone/res/values/strings.xml", 92), - ("external_displays_none", "braille/brailledisplay/src/phone/res/values/strings.xml", 94), - ("title_clear_selection", "talkback/src/main/res/values/strings.xml", 471), - ("script_sources", "talkback/src/main/res/values/strings_scripts.xml", 256), - ("script_sources_none", "talkback/src/main/res/values/strings_scripts.xml", 258), - ("script_source_add", "talkback/src/main/res/values/strings_scripts.xml", 260), - ("script_source_add_button", "talkback/src/main/res/values/strings_scripts.xml", 262), - ("script_source_hint", "talkback/src/main/res/values/strings_scripts.xml", 264), - ("script_source_invalid", "talkback/src/main/res/values/strings_scripts.xml", 266), - ("script_source_exists", "talkback/src/main/res/values/strings_scripts.xml", 268), - ("script_source_loading", "talkback/src/main/res/values/strings_scripts.xml", 270), - ("script_source_empty", "talkback/src/main/res/values/strings_scripts.xml", 272), - ("script_source_failed", "talkback/src/main/res/values/strings_scripts.xml", 274), - ("script_source_retry", "talkback/src/main/res/values/strings_scripts.xml", 276), - ("script_source_downloading", "talkback/src/main/res/values/strings_scripts.xml", 278), - ("script_source_remove", "talkback/src/main/res/values/strings_scripts.xml", 280), - ("script_source_remove_title", "talkback/src/main/res/values/strings_scripts.xml", 282), - ("script_source_remove_message", "talkback/src/main/res/values/strings_scripts.xml", 284), + keys = [ + "battery_optimization_notification_title", + "battery_optimization_notification_text", + "permission_braille_display_label", + "permission_braille_display_description", + "external_display_channel", + "external_display_ask_title", + "external_display_ask_text", + "external_display_warning", + "external_display_allow", + "external_display_deny", + "external_display_in_use_title", + "external_display_in_use_text", + "external_displays_title", + "external_displays_summary", + "external_displays_none", + "title_clear_selection", + "script_sources", + "script_sources_none", + "script_source_add", + "script_source_add_button", + "script_source_hint", + "script_source_invalid", + "script_source_exists", + "script_source_loading", + "script_source_empty", + "script_source_failed", + "script_source_retry", + "script_source_downloading", + "script_source_remove", + "script_source_remove_title", + "script_source_remove_message", ] - path = Path("lint-baseline.xml") - text = path.read_text(encoding="utf-8") - token = ""cs" (Czech)" + text = Path("lint-baseline.xml").read_text(encoding="utf-8") blocks = re.findall(r'', text, flags=re.S) - changed = 0 - for key, source, line in entries: + for key in keys: marker = f'message=""{key}" is not translated' - file_marker = f'file="{source}"' - line_marker = f'line="{line}"' - candidates = [ - b for b in blocks - if marker in b and file_marker in b and line_marker in b - ] - if len(candidates) != 1: - same_key = [b for b in blocks if marker in b] - locations = [] - for b in same_key: - locations.extend(re.findall(r']*/>', b)) - raise SystemExit( - f"{key}: exact lint location {source}:{line} matched {len(candidates)} baseline blocks; " - f"baseline locations for this key: {locations}" - ) + matches = [b for b in blocks if marker in b] + print(f"KEY {key} COUNT {len(matches)}") + for i, block in enumerate(matches, 1): + locations = re.findall(r']*/>', block, flags=re.S) + print(f" MATCH {i}") + for location in locations: + compact = ' '.join(location.split()) + print(f" {compact}") - block = candidates[0] - if block.count(token) != 1: - raise SystemExit( - f"{key} at {source}:{line}: expected Czech locale exactly once, " - f"found {block.count(token)}" - ) - - if f", {token}" in block: - block2 = block.replace(f", {token}", "", 1) - elif f"{token}, " in block: - block2 = block.replace(f"{token}, ", "", 1) - else: - raise SystemExit(f"{key} at {source}:{line}: unexpected Czech locale placement") - - if text.count(block) != 1: - raise SystemExit(f"{key} at {source}:{line}: selected baseline block is not unique") - text = text.replace(block, block2, 1) - blocks[blocks.index(block)] = block2 - changed += 1 - - if changed != 31: - raise SystemExit(f"Expected exactly 31 baseline updates, got {changed}") - - path.write_text(text, encoding="utf-8") - print(f"Updated exactly {changed} MissingTranslation baseline entries using current lint locations") - - - name: Validate and remove temporary validation files - run: | - git diff --check - rm .github/workflows/refresh-czech-lint-baseline.yml - rm -f .ci-trigger - changed=$(git status --short | sed 's/^...//' | sort) - printf '%s\n' "$changed" - test "$changed" = "$(printf '%s\n' '.ci-trigger' '.github/workflows/refresh-czech-lint-baseline.yml' 'lint-baseline.xml' | sort)" - - - name: Commit final baseline refresh - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - git diff --cached --check - git commit -m "Refresh Czech MissingTranslation lint baseline" - git push + print("Diagnostic only: no files were modified.") From 562fd2f3a050fe881511c392f8948c187afd6ae0 Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:58:04 +0200 Subject: [PATCH 11/13] Diagnose exact stale Czech baseline entries --- .github/workflows/refresh-czech-lint-baseline.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml index 9682fa01..4d746f1f 100644 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Print exact baseline locations for Czech translation keys + - name: Print exact stale baseline entries shell: python run: | from pathlib import Path @@ -52,7 +52,7 @@ jobs: "script_source_remove_title", "script_source_remove_message", ] - + token = ""cs" (Czech)" text = Path("lint-baseline.xml").read_text(encoding="utf-8") blocks = re.findall(r'', text, flags=re.S) @@ -62,9 +62,11 @@ jobs: print(f"KEY {key} COUNT {len(matches)}") for i, block in enumerate(matches, 1): locations = re.findall(r']*/>', block, flags=re.S) - print(f" MATCH {i}") + message = re.search(r'message="([^"]*)"', block, flags=re.S) + print(f" MATCH {i} CZECH_TOKEN_COUNT {block.count(token)}") for location in locations: - compact = ' '.join(location.split()) - print(f" {compact}") + print(" LOCATION " + ' '.join(location.split())) + if message: + print(" MESSAGE " + ' '.join(message.group(1).split())) print("Diagnostic only: no files were modified.") From b9691ea82a6cb983e6b8c0f751fb31a98047ec1e Mon Sep 17 00:00:00 2001 From: matejplch626-afk Date: Thu, 15 Oct 2026 19:59:09 +0200 Subject: [PATCH 12/13] Apply exact Czech lint baseline refresh --- .../workflows/refresh-czech-lint-baseline.yml | 154 ++++++++++++------ 1 file changed, 106 insertions(+), 48 deletions(-) diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml index 4d746f1f..0d5e351a 100644 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ b/.github/workflows/refresh-czech-lint-baseline.yml @@ -5,68 +5,126 @@ on: branches: [ "czech-translation" ] permissions: - contents: read + contents: write jobs: - diagnose: + refresh: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Print exact stale baseline entries + - name: Refresh exact stale Czech MissingTranslation entries shell: python run: | from pathlib import Path import re - keys = [ - "battery_optimization_notification_title", - "battery_optimization_notification_text", - "permission_braille_display_label", - "permission_braille_display_description", - "external_display_channel", - "external_display_ask_title", - "external_display_ask_text", - "external_display_warning", - "external_display_allow", - "external_display_deny", - "external_display_in_use_title", - "external_display_in_use_text", - "external_displays_title", - "external_displays_summary", - "external_displays_none", - "title_clear_selection", - "script_sources", - "script_sources_none", - "script_source_add", - "script_source_add_button", - "script_source_hint", - "script_source_invalid", - "script_source_exists", - "script_source_loading", - "script_source_empty", - "script_source_failed", - "script_source_retry", - "script_source_downloading", - "script_source_remove", - "script_source_remove_title", - "script_source_remove_message", + # Each tuple comes from two concrete sources: + # - baseline_path/baseline_line: exact location printed from lint-baseline.xml + # - current_line: exact location in the current lint-results-phoneDebug report + # script_sources intentionally has expected_count=2 because the baseline contains + # two identical stale entries for that same exact resource and location. + entries = [ + ("battery_optimization_notification_title", "src/main/res/values/strings.xml", 177, 177, 1), + ("battery_optimization_notification_text", "src/main/res/values/strings.xml", 179, 179, 1), + ("permission_braille_display_label", "src/main/res/values/strings.xml", 411, 424, 1), + ("permission_braille_display_description", "src/main/res/values/strings.xml", 413, 426, 1), + ("external_display_channel", "braille/brailledisplay/src/phone/res/values/strings.xml", 870, 870, 1), + ("external_display_ask_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 872, 872, 1), + ("external_display_ask_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 874, 874, 1), + ("external_display_warning", "braille/brailledisplay/src/phone/res/values/strings.xml", 876, 876, 1), + ("external_display_allow", "braille/brailledisplay/src/phone/res/values/strings.xml", 878, 878, 1), + ("external_display_deny", "braille/brailledisplay/src/phone/res/values/strings.xml", 880, 880, 1), + ("external_display_in_use_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 882, 882, 1), + ("external_display_in_use_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 884, 884, 1), + ("external_displays_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 886, 886, 1), + ("external_displays_summary", "braille/brailledisplay/src/phone/res/values/strings.xml", 888, 888, 1), + ("external_displays_none", "braille/brailledisplay/src/phone/res/values/strings.xml", 890, 890, 1), + ("title_clear_selection", "src/main/res/values/strings.xml", 1979, 1996, 1), + ("script_sources", "src/main/res/values/strings_scripts.xml", 256, 256, 2), + ("script_sources_none", "src/main/res/values/strings_scripts.xml", 258, 258, 1), + ("script_source_add", "src/main/res/values/strings_scripts.xml", 260, 260, 1), + ("script_source_add_button", "src/main/res/values/strings_scripts.xml", 262, 262, 1), + ("script_source_hint", "src/main/res/values/strings_scripts.xml", 264, 264, 1), + ("script_source_invalid", "src/main/res/values/strings_scripts.xml", 266, 266, 1), + ("script_source_exists", "src/main/res/values/strings_scripts.xml", 268, 268, 1), + ("script_source_loading", "src/main/res/values/strings_scripts.xml", 270, 270, 1), + ("script_source_empty", "src/main/res/values/strings_scripts.xml", 272, 272, 1), + ("script_source_failed", "src/main/res/values/strings_scripts.xml", 274, 274, 1), + ("script_source_retry", "src/main/res/values/strings_scripts.xml", 276, 276, 1), + ("script_source_downloading", "src/main/res/values/strings_scripts.xml", 278, 278, 1), + ("script_source_remove", "src/main/res/values/strings_scripts.xml", 280, 280, 1), + ("script_source_remove_title", "src/main/res/values/strings_scripts.xml", 282, 282, 1), + ("script_source_remove_message", "src/main/res/values/strings_scripts.xml", 284, 284, 1), ] + + path = Path("lint-baseline.xml") + text = path.read_text(encoding="utf-8") token = ""cs" (Czech)" - text = Path("lint-baseline.xml").read_text(encoding="utf-8") blocks = re.findall(r'', text, flags=re.S) + changed_blocks = 0 - for key in keys: + for key, baseline_path, baseline_line, current_line, expected_count in entries: marker = f'message=""{key}" is not translated' - matches = [b for b in blocks if marker in b] - print(f"KEY {key} COUNT {len(matches)}") - for i, block in enumerate(matches, 1): - locations = re.findall(r']*/>', block, flags=re.S) - message = re.search(r'message="([^"]*)"', block, flags=re.S) - print(f" MATCH {i} CZECH_TOKEN_COUNT {block.count(token)}") - for location in locations: - print(" LOCATION " + ' '.join(location.split())) - if message: - print(" MESSAGE " + ' '.join(message.group(1).split())) + file_marker = f'file="{baseline_path}"' + line_marker = f'line="{baseline_line}"' + candidates = [ + b for b in blocks + if marker in b and file_marker in b and line_marker in b and token in b + ] + if len(candidates) != expected_count: + raise SystemExit( + f"{key}: expected {expected_count} exact stale block(s) at " + f"{baseline_path}:{baseline_line}, found {len(candidates)}" + ) + + for block in candidates: + block2 = block + if f", {token}" in block2: + block2 = block2.replace(f", {token}", "", 1) + elif f"{token}, " in block2: + block2 = block2.replace(f"{token}, ", "", 1) + else: + raise SystemExit(f"{key}: unexpected Czech locale placement") + + if current_line != baseline_line: + old_location = f'file="{baseline_path}"\n line="{baseline_line}"' + new_location = f'file="{baseline_path}"\n line="{current_line}"' + if block2.count(old_location) != 1: + raise SystemExit( + f"{key}: exact stored location {baseline_path}:{baseline_line} " + "was not unique inside its issue block" + ) + block2 = block2.replace(old_location, new_location, 1) + + if text.count(block) < 1: + raise SystemExit(f"{key}: selected baseline block disappeared before replacement") + text = text.replace(block, block2, 1) + idx = blocks.index(block) + blocks[idx] = block2 + changed_blocks += 1 + + if changed_blocks != 32: + raise SystemExit(f"Expected exactly 32 baseline block updates, got {changed_blocks}") - print("Diagnostic only: no files were modified.") + path.write_text(text, encoding="utf-8") + print("Updated exactly 32 baseline blocks for 31 Czech strings.") + + - name: Validate diff and remove temporary validation files + run: | + git diff --check + rm .github/workflows/refresh-czech-lint-baseline.yml + rm -f .ci-trigger + changed=$(git status --short | sed 's/^...//' | sort) + expected=$(printf '%s\n' '.ci-trigger' '.github/workflows/refresh-czech-lint-baseline.yml' 'lint-baseline.xml' | sort) + printf 'Changed paths:\n%s\n' "$changed" + test "$changed" = "$expected" + + - name: Commit final baseline refresh + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git diff --cached --check + git commit -m "Refresh Czech MissingTranslation lint baseline" + git push From 2f2ccc761cf8faf19e67b24cd7879526f38c35d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 15 Oct 2026 17:59:20 +0000 Subject: [PATCH 13/13] Refresh Czech MissingTranslation lint baseline --- .ci-trigger | 1 - .../workflows/refresh-czech-lint-baseline.yml | 130 ------------------ lint-baseline.xml | 70 +++++----- 3 files changed, 35 insertions(+), 166 deletions(-) delete mode 100644 .ci-trigger delete mode 100644 .github/workflows/refresh-czech-lint-baseline.yml diff --git a/.ci-trigger b/.ci-trigger deleted file mode 100644 index 18fea524..00000000 --- a/.ci-trigger +++ /dev/null @@ -1 +0,0 @@ -Trigger refreshed Czech baseline validation workflow. diff --git a/.github/workflows/refresh-czech-lint-baseline.yml b/.github/workflows/refresh-czech-lint-baseline.yml deleted file mode 100644 index 0d5e351a..00000000 --- a/.github/workflows/refresh-czech-lint-baseline.yml +++ /dev/null @@ -1,130 +0,0 @@ -name: Refresh Czech lint baseline - -on: - push: - branches: [ "czech-translation" ] - -permissions: - contents: write - -jobs: - refresh: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Refresh exact stale Czech MissingTranslation entries - shell: python - run: | - from pathlib import Path - import re - - # Each tuple comes from two concrete sources: - # - baseline_path/baseline_line: exact location printed from lint-baseline.xml - # - current_line: exact location in the current lint-results-phoneDebug report - # script_sources intentionally has expected_count=2 because the baseline contains - # two identical stale entries for that same exact resource and location. - entries = [ - ("battery_optimization_notification_title", "src/main/res/values/strings.xml", 177, 177, 1), - ("battery_optimization_notification_text", "src/main/res/values/strings.xml", 179, 179, 1), - ("permission_braille_display_label", "src/main/res/values/strings.xml", 411, 424, 1), - ("permission_braille_display_description", "src/main/res/values/strings.xml", 413, 426, 1), - ("external_display_channel", "braille/brailledisplay/src/phone/res/values/strings.xml", 870, 870, 1), - ("external_display_ask_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 872, 872, 1), - ("external_display_ask_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 874, 874, 1), - ("external_display_warning", "braille/brailledisplay/src/phone/res/values/strings.xml", 876, 876, 1), - ("external_display_allow", "braille/brailledisplay/src/phone/res/values/strings.xml", 878, 878, 1), - ("external_display_deny", "braille/brailledisplay/src/phone/res/values/strings.xml", 880, 880, 1), - ("external_display_in_use_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 882, 882, 1), - ("external_display_in_use_text", "braille/brailledisplay/src/phone/res/values/strings.xml", 884, 884, 1), - ("external_displays_title", "braille/brailledisplay/src/phone/res/values/strings.xml", 886, 886, 1), - ("external_displays_summary", "braille/brailledisplay/src/phone/res/values/strings.xml", 888, 888, 1), - ("external_displays_none", "braille/brailledisplay/src/phone/res/values/strings.xml", 890, 890, 1), - ("title_clear_selection", "src/main/res/values/strings.xml", 1979, 1996, 1), - ("script_sources", "src/main/res/values/strings_scripts.xml", 256, 256, 2), - ("script_sources_none", "src/main/res/values/strings_scripts.xml", 258, 258, 1), - ("script_source_add", "src/main/res/values/strings_scripts.xml", 260, 260, 1), - ("script_source_add_button", "src/main/res/values/strings_scripts.xml", 262, 262, 1), - ("script_source_hint", "src/main/res/values/strings_scripts.xml", 264, 264, 1), - ("script_source_invalid", "src/main/res/values/strings_scripts.xml", 266, 266, 1), - ("script_source_exists", "src/main/res/values/strings_scripts.xml", 268, 268, 1), - ("script_source_loading", "src/main/res/values/strings_scripts.xml", 270, 270, 1), - ("script_source_empty", "src/main/res/values/strings_scripts.xml", 272, 272, 1), - ("script_source_failed", "src/main/res/values/strings_scripts.xml", 274, 274, 1), - ("script_source_retry", "src/main/res/values/strings_scripts.xml", 276, 276, 1), - ("script_source_downloading", "src/main/res/values/strings_scripts.xml", 278, 278, 1), - ("script_source_remove", "src/main/res/values/strings_scripts.xml", 280, 280, 1), - ("script_source_remove_title", "src/main/res/values/strings_scripts.xml", 282, 282, 1), - ("script_source_remove_message", "src/main/res/values/strings_scripts.xml", 284, 284, 1), - ] - - path = Path("lint-baseline.xml") - text = path.read_text(encoding="utf-8") - token = ""cs" (Czech)" - blocks = re.findall(r'', text, flags=re.S) - changed_blocks = 0 - - for key, baseline_path, baseline_line, current_line, expected_count in entries: - marker = f'message=""{key}" is not translated' - file_marker = f'file="{baseline_path}"' - line_marker = f'line="{baseline_line}"' - candidates = [ - b for b in blocks - if marker in b and file_marker in b and line_marker in b and token in b - ] - if len(candidates) != expected_count: - raise SystemExit( - f"{key}: expected {expected_count} exact stale block(s) at " - f"{baseline_path}:{baseline_line}, found {len(candidates)}" - ) - - for block in candidates: - block2 = block - if f", {token}" in block2: - block2 = block2.replace(f", {token}", "", 1) - elif f"{token}, " in block2: - block2 = block2.replace(f"{token}, ", "", 1) - else: - raise SystemExit(f"{key}: unexpected Czech locale placement") - - if current_line != baseline_line: - old_location = f'file="{baseline_path}"\n line="{baseline_line}"' - new_location = f'file="{baseline_path}"\n line="{current_line}"' - if block2.count(old_location) != 1: - raise SystemExit( - f"{key}: exact stored location {baseline_path}:{baseline_line} " - "was not unique inside its issue block" - ) - block2 = block2.replace(old_location, new_location, 1) - - if text.count(block) < 1: - raise SystemExit(f"{key}: selected baseline block disappeared before replacement") - text = text.replace(block, block2, 1) - idx = blocks.index(block) - blocks[idx] = block2 - changed_blocks += 1 - - if changed_blocks != 32: - raise SystemExit(f"Expected exactly 32 baseline block updates, got {changed_blocks}") - - path.write_text(text, encoding="utf-8") - print("Updated exactly 32 baseline blocks for 31 Czech strings.") - - - name: Validate diff and remove temporary validation files - run: | - git diff --check - rm .github/workflows/refresh-czech-lint-baseline.yml - rm -f .ci-trigger - changed=$(git status --short | sed 's/^...//' | sort) - expected=$(printf '%s\n' '.ci-trigger' '.github/workflows/refresh-czech-lint-baseline.yml' 'lint-baseline.xml' | sort) - printf 'Changed paths:\n%s\n' "$changed" - test "$changed" = "$expected" - - - name: Commit final baseline refresh - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - git diff --cached --check - git commit -m "Refresh Czech MissingTranslation lint baseline" - git push diff --git a/lint-baseline.xml b/lint-baseline.xml index ad44fd5a..6674f128 100644 --- a/lint-baseline.xml +++ b/lint-baseline.xml @@ -2,7 +2,7 @@ @@ -25949,12 +25949,12 @@