mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 02:42:08 +00:00
fix(i18n): translate the search texts and review the new translations
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user