mirror of
https://github.com/thetasoft/wulkplot-translations.git
synced 2026-03-28 16:14:48 +00:00
Feat: Add translation tools
This commit is contained in:
32
tools/update_translations.py
Normal file
32
tools/update_translations.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import subprocess
|
||||
import glob
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
TRANSLATIONS_DIR = BASE_DIR / "translations"
|
||||
|
||||
util_qt_files = glob.glob(str(BASE_DIR / "util_qt" / "**" / "*.py"), recursive=True)
|
||||
source_files = [str(BASE_DIR / "gui.py")] + util_qt_files
|
||||
|
||||
ts_files = [
|
||||
str(TRANSLATIONS_DIR / "wulkplot_de.ts"),
|
||||
str(TRANSLATIONS_DIR / "wulkplot_fr.ts"),
|
||||
str(TRANSLATIONS_DIR / "wulkplot_no.ts"),
|
||||
str(TRANSLATIONS_DIR / "wulkplot_ru.ts"),
|
||||
]
|
||||
|
||||
cmd = ["pylupdate6"] + source_files
|
||||
for ts in ts_files:
|
||||
cmd += ["-ts", ts]
|
||||
|
||||
print("Running command:")
|
||||
print(" ".join(cmd))
|
||||
|
||||
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||
|
||||
if result.returncode != 0:
|
||||
print("Error:")
|
||||
print(result.stderr)
|
||||
else:
|
||||
print("pylupdate6 completed successfully.")
|
||||
Reference in New Issue
Block a user