Skip to content

Update moz.l10n to 0.11.2 and translate-toolkit to 3.19.3#4028

Merged
eemeli merged 2 commits intomozilla:mainfrom
eemeli:update-deps
Mar 24, 2026
Merged

Update moz.l10n to 0.11.2 and translate-toolkit to 3.19.3#4028
eemeli merged 2 commits intomozilla:mainfrom
eemeli:update-deps

Conversation

@eemeli
Copy link
Member

@eemeli eemeli commented Mar 18, 2026

The significant change here is moz.l10n's Fluent serialization, which now by default correctly escapes syntactical content found in text spans. Mostly this shows up by leading whitespace now getting escaped in FTL files; previously any leading whitespace in a Fluent translation was effectively dropped. The non-default behaviour is enabled with escape_syntax=False, and is used during pretranslation.

If it's desirable that we do not include leading whitespace in formatted outputs, we'll need to include a migration here.

This fixes #4003 thanks to moz.l10n now considering %@ in the Android translation as a placeholder, so that its introduction is an error because a matching one isn't included in the original source.

The translate-toolkit update is coming along for the ride, to allow for lxml 6.0 as a transitive dependency, due to mozilla/moz-l10n#118.

@eemeli eemeli requested review from flodolo and mathjazz March 18, 2026 19:14
@flodolo
Copy link
Collaborator

flodolo commented Mar 18, 2026

Mostly this shows up by leading whitespace now getting escaped in FTL files; previously any leading whitespace in a Fluent translation was effectively dropped.

Just to make sure I understand: if we have a Fluent translation with leading whitespaces, so far these would get dropped when serializing. Wouldn't that result in the translation being imported from VCS without the leading whitespaces?

Assuming my understanding is correct — which I doubt — I think this will result in no change in serialized content, and no need for migrations?

@mathjazz
Copy link
Collaborator

The code looks good!

The significant change here is moz.l10n's Fluent serialization, which now by default correctly escapes syntactical content found in text spans. Mostly this shows up by leading whitespace now getting escaped in FTL files; previously any leading whitespace in a Fluent translation was effectively dropped. The non-default behaviour is enabled with escape_syntax=False, and is used during pretranslation.

What is the motivation for this change? Could you provide example entities / translations where the behaviour will be different?

@eemeli
Copy link
Member Author

eemeli commented Mar 19, 2026

I think I'd misremembered that Fluent ignored all leading indents, as in fact it only ignores common indents. I submitted mozilla/moz-l10n#129 to fix that; this PR will need a subsequent update to incorporate that change.

After that, the treatment of leading spaces should be unchanged from the previous.

@eemeli eemeli changed the title Update moz.l10n to 0.11.1 and translate-toolkit to 3.19.3 Update moz.l10n to 0.11.2 and translate-toolkit to 3.19.3 Mar 24, 2026
@eemeli
Copy link
Member Author

eemeli commented Mar 24, 2026

@mathjazz @flodolo Updated moz.l10n, so this PR should no longer have any effect on the FTL serialization of leading spaces. PTAL?

@flodolo
Copy link
Collaborator

flodolo commented Mar 24, 2026

PTAL?

skeptical-futurama

(I get it, never seen it before though…)

Copy link
Collaborator

@flodolo flodolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried a forced sync locally, nothing strange happened.

Copy link
Collaborator

@mathjazz mathjazz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eemeli eemeli merged commit 1e1e7c6 into mozilla:main Mar 24, 2026
3 checks passed
@eemeli eemeli deleted the update-deps branch March 24, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android error not blocked by linter

3 participants