mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
refactor(translate_apps): move translations in a manifest subfolder
This commit is contained in:
parent
6afaaf37c9
commit
4b1454d04c
2 changed files with 5 additions and 3 deletions
|
@ -106,12 +106,14 @@ def extract_strings_to_translate_from_apps(apps, translations_repository):
|
||||||
print(app)
|
print(app)
|
||||||
print(f"{repository_uri} -> branch '{branch}'")
|
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):
|
if not translations_repository.file_exists(translations_path):
|
||||||
print(f"App {app} doesn't have translations on github.com/yunohost/apps_translations, skip")
|
print(f"App {app} doesn't have translations on github.com/yunohost/apps_translations, skip")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
translations_path = translations_repository.path / translations_path
|
||||||
|
|
||||||
with Repository(
|
with Repository(
|
||||||
f"https://{login}:{token}@github.com/{repository_uri}", branch
|
f"https://{login}:{token}@github.com/{repository_uri}", branch
|
||||||
) as repository:
|
) as repository:
|
||||||
|
@ -120,7 +122,7 @@ def extract_strings_to_translate_from_apps(apps, translations_repository):
|
||||||
|
|
||||||
manifest = tomlkit.loads(repository.read_file("manifest.toml"))
|
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")]
|
language = translation.name[:-len(".json")]
|
||||||
|
|
||||||
# english version is the base, never modify it
|
# english version is the base, never modify it
|
||||||
|
|
|
@ -118,7 +118,7 @@ def extract_strings_to_translate_from_apps(apps, translations_repository):
|
||||||
|
|
||||||
manifest = tomlkit.loads(repository.read_file("manifest.toml"))
|
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
|
newly_created_translation = False
|
||||||
if not translations_repository.file_exists(translations_path):
|
if not translations_repository.file_exists(translations_path):
|
||||||
|
|
Loading…
Add table
Reference in a new issue