1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

fix(translate_apps): the path to check if files existed was in the wrong PWD

This commit is contained in:
Laurent Peuch 2024-03-31 06:44:43 +02:00 committed by OniriCorpe
parent a3b7509a74
commit b694ee9c38

View file

@ -98,14 +98,15 @@ def extract_strings_to_translate_from_apps(apps, translations_repository):
continue
# if the translation file doesn't exist yet, dump it
if not (translations_path / f"{language}.json").exists():
if not translations_repository.file_exists(translations_path / f"{language}.json"):
translations_repository.write_file(
translations_path / f"{language}.json",
json.dumps(translated_strings, indent=4, sort_keys=True, ensure_ascii=False) + "\n",
)
else: # if it exists, only add keys that aren't already present
language_file = json.load((translations_path / f"{language}.json").open())
language_file = json.loads(translations_repository.read_file(translations_path / f"{language}.json"))
for key, translated_string in translated_strings.items():
if key not in language_file:
language_file[key] = translated_string