sunnypilot v2026.002.000
version: sunnypilot v2026.002.000 (staging) date: 2026-07-21T07:44:02 master commit: 2c334ede443d7391d27575af8c854a095ba702a8
This commit is contained in:
commit
de77c89cf6
3995 files changed
+1260688
No files matched your search
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
from itertools import chain
|
||||
import os
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.system.ui.lib.multilang import SYSTEM_UI_DIR, UI_DIR, TRANSLATIONS_DIR, multilang
|
||||
from openpilot.selfdrive.ui.translations.potools import extract_strings, generate_pot, merge_po, init_po
|
||||
|
||||
LANGUAGES_FILE = os.path.join(str(TRANSLATIONS_DIR), "languages.json")
|
||||
POT_FILE = os.path.join(str(TRANSLATIONS_DIR), "app.pot")
|
||||
|
||||
|
||||
def update_translations():
|
||||
files = []
|
||||
for root, _, filenames in chain(os.walk(SYSTEM_UI_DIR),
|
||||
os.walk(os.path.join(UI_DIR, "widgets")),
|
||||
os.walk(os.path.join(UI_DIR, "layouts")),
|
||||
os.walk(os.path.join(UI_DIR, "onroad"))):
|
||||
for filename in filenames:
|
||||
if filename.endswith(".py"):
|
||||
files.append(os.path.relpath(os.path.join(root, filename), BASEDIR))
|
||||
|
||||
# Extract translatable strings and generate .pot template
|
||||
entries = extract_strings(files, BASEDIR)
|
||||
generate_pot(entries, POT_FILE)
|
||||
|
||||
# Generate/update translation files for each language
|
||||
for name in multilang.languages.values():
|
||||
po_file = os.path.join(TRANSLATIONS_DIR, f"app_{name}.po")
|
||||
if os.path.exists(po_file):
|
||||
merge_po(po_file, POT_FILE)
|
||||
else:
|
||||
init_po(POT_FILE, po_file, name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
update_translations()
|
||||
Reference in new issue
Block a user