translations: remove locations (#25826)

* Remove locations

* no line nos
old-commit-hash: 35f624c628
taco
Shane Smiskol 3 years ago committed by GitHub
parent a16eff689a
commit 9b10593c8f
  1. 12
      selfdrive/ui/tests/test_translations.py
  2. 4
      selfdrive/ui/translations/main_en.ts
  3. 248
      selfdrive/ui/translations/main_ja.ts
  4. 248
      selfdrive/ui/translations/main_ko.ts
  5. 248
      selfdrive/ui/translations/main_pt-BR.ts
  6. 248
      selfdrive/ui/translations/main_zh-CHS.ts
  7. 248
      selfdrive/ui/translations/main_zh-CHT.ts
  8. 2
      selfdrive/ui/update_translations.py

@ -29,10 +29,7 @@ class TestTranslations(unittest.TestCase):
def _read_translation_file(path, file):
tr_file = os.path.join(path, f"{file}.ts")
with open(tr_file, "r") as f:
# ignore locations when checking if translations are updated
lines = [line for line in f.read().splitlines() if
not line.strip().startswith(LOCATION_TAG)]
return "\n".join(lines)
return f.read()
def test_missing_translation_files(self):
for name, file in self.translation_files.items():
@ -93,6 +90,13 @@ class TestTranslations(unittest.TestCase):
self.assertTrue(all([re.search("%[0-9]+", t) is None for t in numerusform]),
"Plural translations must use %n, not %1, %2, etc.: {}".format(numerusform))
def test_no_locations(self):
for name, file in self.translation_files.items():
with self.subTest(name=name, file=file):
for line in self._read_translation_file(TRANSLATIONS_DIR, file).splitlines():
self.assertFalse(line.strip().startswith(LOCATION_TAG),
f"Line contains location tag: {line.strip()}, remove all line numbers.")
if __name__ == "__main__":
unittest.main()

@ -4,7 +4,6 @@
<context>
<name>InputDialog</name>
<message numerus="yes">
<location filename="../qt/widgets/input.cc" line="+168"/>
<source>Need at least %n character(s)!</source>
<translation>
<numerusform>Need at least %n character!</numerusform>
@ -15,7 +14,6 @@
<context>
<name>QObject</name>
<message numerus="yes">
<location filename="../qt/util.cc" line="+82"/>
<source>%n minute(s) ago</source>
<translation>
<numerusform>%n minute ago</numerusform>
@ -23,7 +21,6 @@
</translation>
</message>
<message numerus="yes">
<location line="+3"/>
<source>%n hour(s) ago</source>
<translation>
<numerusform>%n hour ago</numerusform>
@ -31,7 +28,6 @@
</translation>
</message>
<message numerus="yes">
<location line="+3"/>
<source>%n day(s) ago</source>
<translation>
<numerusform>%n day ago</numerusform>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -19,7 +19,7 @@ def update_translations(vanish=False, plural_only=None, translations_dir=TRANSLA
for file in translation_files.values():
tr_file = os.path.join(translations_dir, f"{file}.ts")
args = f"lupdate -locations relative -recursive {UI_DIR} -ts {tr_file}"
args = f"lupdate -locations none -recursive {UI_DIR} -ts {tr_file}"
if vanish:
args += " -no-obsolete"
if file in plural_only:

Loading…
Cancel
Save