fix(i18n): translate the search texts and review the new translations

This commit is contained in:
MacRimi
2026-10-11 14:21:59 +02:00
parent dd16682603
commit 873a3cd8e2
10 changed files with 181 additions and 101 deletions
+27
View File
@@ -6,6 +6,7 @@ import importlib.util
import json
from pathlib import Path
import re
import runpy
import unittest
ROOT = Path(__file__).resolve().parents[3]
@@ -151,5 +152,31 @@ class OpenedInPlaceTests(unittest.TestCase):
self.assertIn('subparsers.add_parser("open"', cli)
class TranslationTests(unittest.TestCase):
"""What the search and the main menu say reaches the translation workflow,
read with the folders the workflow itself passes."""
@classmethod
def setUpClass(cls):
workflow = (ROOT / ".github/workflows/build-translation-cache.yml").read_text()
extractor = runpy.run_path(str(ROOT / ".github/scripts/build_translation_cache.py"))
folders = [ROOT / folder for folder in re.findall(r"--python-dir (\S+)", workflow)]
cls.found = set(extractor["extract_python_texts"](folders))
cls.found |= set(extractor["extract_translate_texts"](SCRIPTS))
cls.triggers = workflow
def test_every_text_of_the_search_is_found(self):
source = (SCRIPTS / "menus/search_menu.py").read_text()
said = set(re.findall(r"translate\('([^']+)'\)", source))
self.assertIn("No results", said)
self.assertEqual(sorted(said - self.found), [])
def test_the_title_of_the_main_menu_is_found(self):
self.assertIn("Main menu", self.found)
def test_a_change_in_the_search_runs_the_workflow(self):
self.assertIn("'scripts/**/*.py'", self.triggers)
if __name__ == "__main__":
unittest.main()
@@ -16,6 +16,7 @@ on:
paths:
- 'scripts/**/*.sh'
- 'scripts/**/*.func'
- 'scripts/**/*.py'
- 'menu'
- 'install_proxmenux.sh'
- 'install_proxmenux_beta.sh'
@@ -85,6 +86,7 @@ jobs:
--extra-file install_proxmenux.sh \
--extra-file install_proxmenux_beta.sh \
--extra-dir oci/remote \
--python-dir scripts \
--python-dir oci/src \
--python-dir oci/remote \
--catalog-dir oci/catalog \
+2
View File
@@ -13,6 +13,7 @@ on:
# Scheduler consumers and the offline extractor's .sh/.func inputs.
- 'scripts/**/*.sh'
- 'scripts/**/*.func'
- 'scripts/**/*.py'
- 'lang/*.json'
- 'oci/src/**/*.py'
- 'oci/catalog/**/*.json'
@@ -30,6 +31,7 @@ on:
# Scheduler consumers and the offline extractor's .sh/.func inputs.
- 'scripts/**/*.sh'
- 'scripts/**/*.func'
- 'scripts/**/*.py'
- 'lang/*.json'
- 'oci/src/**/*.py'
- 'oci/catalog/**/*.json'