1.0.7 - polski interfejs i porządki w dokumentacji
Wydanie WGTools-Extended / release (push) Successful in 8s

This commit is contained in:
asminme committed 2026-10-30 15:04:45 +01:00
1 parent 97f73a6277
commit babbdee26d
39 files changed
+142 -24356

No files matched your search

+5 -39
View File
@@ -1,42 +1,8 @@
"""Prevent non-Russian, non-English help falling back to English again."""
from __future__ import annotations
import json
import unittest
from pathlib import Path
from app.core.help_content import HELP, get_help_sections
ROOT = Path(__file__).resolve().parents[1]
LANGUAGES = ('de', 'fr', 'it', 'es', 'pl')
class HelpTranslationTests(unittest.TestCase):
def test_all_five_help_dictionaries_loaded(self):
original = get_help_sections('en')
for language in LANGUAGES:
with self.subTest(language=language):
file = ROOT/'app/core/help_locales'/f'{language}.json'
self.assertTrue(file.is_file())
data = json.loads(file.read_text(encoding='utf8'))
self.assertEqual(data, get_help_sections(language))
self.assertEqual(len(data),len(original))
self.assertEqual([s['id'] for s in data], [s['id'] for s in original])
self.assertNotEqual(data[0]['title'], original[0]['title'])
self.assertNotEqual(data[0]['topics'][0]['paragraphs'][0],original[0]['topics'][0]['paragraphs'][0])
for section, ref_section in zip(data, original):
self.assertTrue(section['title'].strip())
self.assertTrue(section['intro'].strip())
self.assertEqual(len(section['topics']),len(ref_section['topics']))
for topic, reference in zip(section['topics'],ref_section['topics']):
self.assertTrue(topic['title'].strip())
self.assertTrue(all(x.strip() for x in topic['paragraphs']))
self.assertEqual(bool(topic['example_lines']),bool(reference['example_lines']))
self.assertEqual(bool(topic['warning']),bool(reference['warning']))
# Common technical terms such as Diagnostics can legitimately match English.
self.assertNotEqual(topic['paragraphs'][0],reference['paragraphs'][0],"untranslated help paragraph")
self.assertTrue(all(x.strip() for x in topic['bullets']))
def test_unknown_language_defaults_to_english(self):
self.assertEqual(get_help_sections('non-existent-language'), HELP['en'])
def test_version(self):
self.assertEqual((ROOT/'VERSION').read_text().strip(),'1.0.6')
if __name__ == '__main__':
unittest.main()
def test_help_is_polish():
sections = get_help_sections("pl")
assert sections and sections == HELP["pl"]
assert get_help_sections("en") == sections
assert all(section["title"] and section["topics"] for section in sections)