From 8c7a5edb835663ddf57cf61b8f666413cbaaafda Mon Sep 17 00:00:00 2001 From: kwadronaut Date: Fri, 1 Mar 2024 00:57:49 +0000 Subject: Update l10n for app and app store meta data. Tweaks the tx config and the python script to pull all translations from Transifex and parse the meta data in a fastlane compatible format. --- scripts/pullTranslations.py | 164 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100755 scripts/pullTranslations.py (limited to 'scripts/pullTranslations.py') diff --git a/scripts/pullTranslations.py b/scripts/pullTranslations.py new file mode 100755 index 00000000..edfd5718 --- /dev/null +++ b/scripts/pullTranslations.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 +"" +__author__ = "kwadronaut, cyberta" +__copyright__ = "Copyright 2023, LEAP" +__license__ = "GPL3 or later3 or later3 or later" +__version__ = "2" + +import os +import re +import argparse +import json +import subprocess +import sys + +def get_script_path(): + return os.path.dirname(os.path.realpath(sys.argv[0])) + + +# Set the path to the res directory containing different language folders +main_res_dir = get_script_path() + "/../app/src/main/res" +custom_res_dir = get_script_path() + "/../app/src/custom/res" + +# List all valid locale folders in the res directory +# We don't want to create a translated store listing without localized app +def list_locales(app_type): + locales = [] + if app_type == "main": + res_dir = main_res_dir + elif app_type == "custom": + res_dir = custom_res_dir + else: + raise ValueError("Invalid app type. Use 'main' or 'custom'.") + + valid_locale_pattern = re.compile(r'^values-(?P[a-z]{2})(-(?P