Skip to content

uucore: add regression test for #11247 (eager en-US.ftl parse)#12161

Open
naoNao89 wants to merge 2 commits intouutils:mainfrom
naoNao89:fix-11247-lazy-english-ftl
Open

uucore: add regression test for #11247 (eager en-US.ftl parse)#12161
naoNao89 wants to merge 2 commits intouutils:mainfrom
naoNao89:fix-11247-lazy-english-ftl

Conversation

@naoNao89
Copy link
Copy Markdown
Contributor

@naoNao89 naoNao89 commented May 6, 2026

Fixes #11247

init_localization eagerly parses en-US.ftl on every startup, even when the system locale (e.g. fr-FR) loads successfully and no English fallback lookup ever occurs. This wastes startup time and memory for non-English users

Adds a failing test asserting that en-US.ftl is not parsed when the
primary (non-English) locale loads successfully and no fallback lookup
has occurred. Currently fails (parses 1x); will pass once the English
fallback bundle is built lazily.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

GNU testsuite comparison:

GNU test failed: tests/cp/sparse-to-pipe. tests/cp/sparse-to-pipe is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)

@naoNao89 naoNao89 force-pushed the fix-11247-lazy-english-ftl branch from 3f7b717 to b2d458c Compare May 6, 2026 04:50
@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 6, 2026

Thanks! I'm waiting CodSpeed.

@naoNao89 naoNao89 force-pushed the fix-11247-lazy-english-ftl branch from b2d458c to 8a21470 Compare May 6, 2026 04:54
When the primary (non-English) locale loads successfully, en-US.ftl
is no longer parsed at startup. The English bundle is now constructed
on demand the first time a message lookup misses the primary bundle,
saving startup time and memory for non-English users.

- Add `Localizer::with_lazy_fallback(builder)` alongside the existing
  eager `with_fallback`, with interior mutability to materialize the
  fallback at lookup time.
- Use the lazy path in `init_localization`, the WASI branch of
  `setup_localization`, and the test helper `init_test_localization`.
- The previously failing regression test
  `test_english_not_parsed_when_primary_locale_loads` now passes.
@naoNao89 naoNao89 force-pushed the fix-11247-lazy-english-ftl branch from 8a21470 to 0478329 Compare May 6, 2026 04:59
@oech3
Copy link
Copy Markdown
Contributor

oech3 commented May 6, 2026

No change since our benches are mostly working with english...
Maybe, we should add french dd bench with progress.

@sylvestre
Copy link
Copy Markdown
Contributor

What happens if the string isn't available in French or other locales?

I guess it will return the code and not fallback to English. AFAIK, it is the current behavior

@naoNao89
Copy link
Copy Markdown
Contributor Author

naoNao89 commented May 6, 2026

right, this PR can't show a speed change on CodSpeed because CodSpeed runs under en-US: English is the primary bundle and is still built eagerly, so the lazy path is a no-op there

the win only shows up when LANG is non-English (fr_FR.UTF-8) where the previously eager Eng parse becomes deferred

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.

uucore: Do not parse English *ftl if system locale was loaded

3 participants