Files
pallectrum/contrib/pull_locale

22 lines
794 B
Plaintext
Raw Normal View History

2017-08-27 08:01:12 +02:00
#!/usr/bin/env python3
import os
2018-03-09 19:13:42 +01:00
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")
2015-02-21 12:41:52 +01:00
# 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)
2015-02-21 12:41:52 +01:00
lu_module.pull_locale(locale_path)
2015-02-21 12:41:52 +01:00
# Convert .po to .mo
subprocess.check_output([f"{project_root}/contrib/build_locale.sh", locale_path, locale_path])