From 4b1454d04c63f730bd7fe22dafa0127f76c26769 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 28 Mar 2024 05:35:24 +0100 Subject: [PATCH] refactor(translate_apps): move translations in a manifest subfolder --- tools/translate_apps/apps_translations_to_apps.py | 6 ++++-- tools/translate_apps/push_or_update_apps_on_repository.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/translate_apps/apps_translations_to_apps.py b/tools/translate_apps/apps_translations_to_apps.py index 60c0f489..0f83f4e4 100644 --- a/tools/translate_apps/apps_translations_to_apps.py +++ b/tools/translate_apps/apps_translations_to_apps.py @@ -106,12 +106,14 @@ def extract_strings_to_translate_from_apps(apps, translations_repository): print(app) print(f"{repository_uri} -> branch '{branch}'") - translations_path = Path(f"translations/apps/{app}/") + translations_path = Path(f"translations/apps/{app}/manifest/") if not translations_repository.file_exists(translations_path): print(f"App {app} doesn't have translations on github.com/yunohost/apps_translations, skip") continue + translations_path = translations_repository.path / translations_path + with Repository( f"https://{login}:{token}@github.com/{repository_uri}", branch ) as repository: @@ -120,7 +122,7 @@ def extract_strings_to_translate_from_apps(apps, translations_repository): manifest = tomlkit.loads(repository.read_file("manifest.toml")) - for translation in (translations_repository.path / f"translations/apps/{app}/").glob("*.json"): + for translation in translations_path.glob("*.json"): language = translation.name[:-len(".json")] # english version is the base, never modify it diff --git a/tools/translate_apps/push_or_update_apps_on_repository.py b/tools/translate_apps/push_or_update_apps_on_repository.py index 5be1421d..83f0d4ad 100644 --- a/tools/translate_apps/push_or_update_apps_on_repository.py +++ b/tools/translate_apps/push_or_update_apps_on_repository.py @@ -118,7 +118,7 @@ def extract_strings_to_translate_from_apps(apps, translations_repository): manifest = tomlkit.loads(repository.read_file("manifest.toml")) - translations_path = Path(f"translations/apps/{app}/") + translations_path = Path(f"translations/apps/{app}/manifest/") newly_created_translation = False if not translations_repository.file_exists(translations_path):