chore(translations): smarter crowdin.py merge - replace /n/n with /n/r - skip English during merge [no changelog]
What changed, and why it matters
This is a routine internal tooling change for managing translation files. It adjusts how translation text downloaded from the Crowdin service is cleaned up before being saved, and skips processing English-language 'translations' because they are empty and would overwrite the existing English file. There is no security relevance.
No security action needed. Treat as a normal maintenance commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies core/translations/crowdin.py, a helper script for merging translation data exported from Crowdin. It adds two behaviors: (1) replacing double newlines (\n\n) with newline-carriage return (\n\r) to undo a Crowdin import conversion, and (2) skipping the ‘en’ language during merge because Crowdin returns empty English target translations that overwrite en.json. The change is purely a build/translation workflow fix.
Changed components
core/translations/crowdin.pyInspect captured patch +7 / −0
diff --git a/core/translations/crowdin.py b/core/translations/crowdin.py
index 9d192b93..03c85f90 100644
--- a/core/translations/crowdin.py
+++ b/core/translations/crowdin.py
@@ -55,9 +55,16 @@ def merge() -> None:
# Replace non-breaking spaces with regular spaces, EXCEPT before ? ! and :
# Use negative lookahead to avoid replacing before French punctuation
text = re.sub(r'\u00A0(?![?!:])', ' ', text)
+ # Replace double newlines with newline-carriage return
+ # This is needed because Crowdin converts \n\r to \n\n on import
+ text = text.replace("\n\n", "\n\r")
return text
for lang in sorted(tdir.all_languages()):
+ # No reason to process English "translations", they are empty and overwrite en.json
+ # This is happening because English was added to Crowdin as a target language
+ if lang == "en":
+ continue
merged_translations: dict[str, str | dict[str, str]] = collections.defaultdict(dict)
for layout_type in translations.ALL_LAYOUTS:
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.