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: 42e4efe706
taco
AlexandreSato 3 years ago committed by GitHub
parent 179b0d1a81
commit 14a6aa77d6
  1. 18
      selfdrive/ui/tests/test_translations.py
  2. 1
      selfdrive/ui/translations/README.md
  3. 1
      selfdrive/ui/translations/languages.json
  4. 1307
      selfdrive/ui/translations/main_pt.ts

@ -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
[![language](https://raw.githubusercontent.com/commaai/openpilot/badges/translation_badge_main_en.svg)](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_en.ts)
[![language](https://raw.githubusercontent.com/commaai/openpilot/badges/translation_badge_main_pt.svg)](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_pt.ts)
[![language](https://raw.githubusercontent.com/commaai/openpilot/badges/translation_badge_main_zh-CHT.svg)](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_zh-CHT.ts)
[![language](https://raw.githubusercontent.com/commaai/openpilot/badges/translation_badge_main_zh-CHS.svg)](https://github.com/commaai/openpilot/blob/master/selfdrive/ui/translations/main_zh-CHS.ts)
[![language](https://raw.githubusercontent.com/commaai/openpilot/badges/translation_badge_main_ko.svg)](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",

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save