Skip to content

Commit d7f9d3e

Browse files
committed
chore(translations): smarter crowdin.py merge
- replace /n/n with /n/r - skip English during merge [no changelog]
1 parent 4602c0c commit d7f9d3e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

core/translations/crowdin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,16 @@ def clean_translation(text: str) -> str:
5555
# Replace non-breaking spaces with regular spaces, EXCEPT before ? ! and :
5656
# Use negative lookahead to avoid replacing before French punctuation
5757
text = re.sub(r'\u00A0(?![?!:])', ' ', text)
58+
# Replace double newlines with newline-carriage return
59+
# This is needed because Crowdin converts \n\r to \n\n on import
60+
text = text.replace("\n\n", "\n\r")
5861
return text
5962

6063
for lang in sorted(tdir.all_languages()):
64+
# No reason to process English "translations", they are empty and overwrite en.json
65+
# This is happening because English was added to Crowdin as a target language
66+
if lang == "en":
67+
continue
6168
merged_translations: dict[str, str | dict[str, str]] = collections.defaultdict(dict)
6269

6370
for layout_type in translations.ALL_LAYOUTS:

0 commit comments

Comments
 (0)