Multilang: add Portuguese (Brazil) translation (#25287)
* Add Portuguese-Brazil translations * Fixing some Japanese I used as a base. * Add pt_BR translation * Add QM file * multilang: Fix typo and missing pt_BR translation * fix typos in calibration translation * pt_BR new translations * fix translations * update qm * add Thai translation tkx tape#7233 * fix pt_BR translation * improve pt_BR translation * connect means connection not connected * update * plurals and typo * fix unitTest error * Add pt badge * Add test for missing plural translations * Make sure this doesn't test for translation completeness, we skip that test * fix missing plurals Co-authored-by: Shane Smiskol <shane@smiskol.com> old-commit-hash: 42e4efe706ab41958dc1877701fc947149baf053
This commit is contained in:
@@ -3,6 +3,7 @@ import json
|
||||
import os
|
||||
import shutil
|
||||
import unittest
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from selfdrive.ui.update_translations import TRANSLATIONS_DIR, LANGUAGES_FILE, update_translations
|
||||
|
||||
@@ -64,6 +65,23 @@ class TestTranslations(unittest.TestCase):
|
||||
self.assertTrue(b"<translation type=\"vanished\">" not in cur_translations,
|
||||
f"{file} ({name}) translation file has obsolete translations. Run selfdrive/ui/update_translations.py --vanish to remove them")
|
||||
|
||||
def test_plural_translations(self):
|
||||
for name, file in self.translation_files.items():
|
||||
with self.subTest(name=name, file=file):
|
||||
tr_xml = ET.parse(os.path.join(TRANSLATIONS_DIR, f"{file}.ts"))
|
||||
|
||||
for context in tr_xml.getroot():
|
||||
for message in context.iterfind("message"):
|
||||
if message.get("numerus") == "yes":
|
||||
translation = message.find("translation")
|
||||
numerusform = translation.findall("numerusform")
|
||||
|
||||
# Do not assert finished translations
|
||||
if translation.get("type") == "unfinished":
|
||||
continue
|
||||
|
||||
self.assertNotIn(None, [x.text for x in numerusform], "Ensure all plural translation forms are completed.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Multilanguage
|
||||
|
||||
[](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_en.ts)
|
||||
[](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_pt.ts)
|
||||
[](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_zh-CHT.ts)
|
||||
[](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_zh-CHS.ts)
|
||||
[](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_ko.ts)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"English": "main_en",
|
||||
"Português": "main_pt",
|
||||
"中文(繁體)": "main_zh-CHT",
|
||||
"中文(简体)": "main_zh-CHS",
|
||||
"한국어": "main_ko",
|
||||
|
||||
1307
selfdrive/ui/translations/main_pt.ts
Normal file
1307
selfdrive/ui/translations/main_pt.ts
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user