22 lines
794 B
Python
Executable File
22 lines
794 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import subprocess
|
|
import importlib.util
|
|
|
|
project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
|
locale_path = os.path.join(project_root, "electrum", "locale")
|
|
|
|
# download latest .po files from crowdin
|
|
locale_update = os.path.join(project_root, "contrib", "deterministic-build", "electrum-locale", "update.py")
|
|
assert os.path.exists(locale_update)
|
|
# load update.py; needlessly complicated alternative to "imp.load_source":
|
|
lu_spec = importlib.util.spec_from_file_location('update', locale_update)
|
|
lu_module = importlib.util.module_from_spec(lu_spec)
|
|
lu_spec.loader.exec_module(lu_module)
|
|
|
|
lu_module.pull_locale(locale_path)
|
|
|
|
# Convert .po to .mo
|
|
subprocess.check_output([f"{project_root}/contrib/build_locale.sh", locale_path, locale_path])
|
|
|