Skip to content

Commit 9a237bc

Browse files
authored
Merge pull request #19 from session-foundation/chore/desktop-export-glossary-dict-as-translations
chore: desktop: export all constants as localisable strings
2 parents 9bf06e8 + 2caedfe commit 9a237bc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crowdin/generate_desktop_strings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ def convert_xliff_to_json(input_file, output_dir, locale, locale_two_letter_code
110110

111111
for resname in glossary_dict:
112112
target = glossary_dict[resname]
113-
if(matches_braced_pattern(target)):
114-
converted_translations[snake_to_camel(resname)] = generate_icu_pattern(target, glossary_dict)
113+
# Note: this adds the glossary dict items to the translated strings.
114+
# This way, we can use desktop <Localiser /> and tr function with them directly
115+
converted_translations[snake_to_camel(resname)] = generate_icu_pattern(target, glossary_dict)
115116

116117
# Generate output files
117118
output_locale = LOCALE_PATH_MAPPING.get(locale, LOCALE_PATH_MAPPING.get(locale_two_letter_code, locale_two_letter_code))
@@ -120,7 +121,7 @@ def convert_xliff_to_json(input_file, output_dir, locale, locale_two_letter_code
120121
os.makedirs(locale_output_dir, exist_ok=True)
121122

122123
with open(output_file, 'w', encoding='utf-8') as file:
123-
json.dump(converted_translations, file, ensure_ascii=False, indent=2)
124+
json.dump(converted_translations, file, ensure_ascii=False, indent=2, sort_keys=True)
124125
file.write('\n')
125126
file.write('\n')
126127
return output_locale

0 commit comments

Comments
 (0)