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:
parent
a3b7509a74
commit
b694ee9c38
1 changed files with 3 additions and 2 deletions
|
@ -98,14 +98,15 @@ def extract_strings_to_translate_from_apps(apps, translations_repository):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# if the translation file doesn't exist yet, dump it
|
# 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_repository.write_file(
|
||||||
translations_path / f"{language}.json",
|
translations_path / f"{language}.json",
|
||||||
json.dumps(translated_strings, indent=4, sort_keys=True, ensure_ascii=False) + "\n",
|
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
|
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():
|
for key, translated_string in translated_strings.items():
|
||||||
if key not in language_file:
|
if key not in language_file:
|
||||||
language_file[key] = translated_string
|
language_file[key] = translated_string
|
||||||
|
|
Loading…
Add table
Reference in a new issue