Skip Android UI-mode values-* qualifier dirs (e.g. values-car) when pruning#747
Open
oguzkocer wants to merge 1 commit into
Open
Skip Android UI-mode values-* qualifier dirs (e.g. values-car) when pruning#747oguzkocer wants to merge 1 commit into
values-* qualifier dirs (e.g. values-car) when pruning#747oguzkocer wants to merge 1 commit into
Conversation
The locale-detection regex's 2-3 letter language branch also matches Android UI-mode qualifiers like `values-car`, which would prune valid car-mode resources. `car` is also a valid 3-letter ISO 639 language code and cannot be distinguished from a locale by shape alone, so exclude the documented UI-mode qualifiers explicitly. Changes: - Add UI_MODE_QUALIFIERS exclusion list and apply it in locale detection - Add a values-kmr test covering 3-letter legacy locales - Note locale-only scope in the CHANGELOG entry
Collaborator
Generated by 🚫 Danger |
5 tasks
mokagio
approved these changes
Jul 1, 2026
mokagio
left a comment
Contributor
There was a problem hiding this comment.
Thank you for following up on this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The situation
#746 (by
@mokagio, already merged into this branch) added a regression test showing thatandroid_prune_orphaned_translationstreatsvalues-caras a locale and would prune its resources. That test currently fails on this branch.Root cause: the locale-detection regex's 2–3 letter language branch (
[a-z]{2,3}) matchescar. Butvalues-caris the Android UI-mode qualifier (docs), not a locale. The catch is thatcaris also a valid 3-letter ISO 639 language code, so there's no purely syntactic way for a regex to tellvalues-car-the-UI-mode fromvalues-car-the-language — Android itself can't either.What this PR does
UI_MODE_QUALIFIERSlist. In practicecaris the only one short enough to collide today; the rest are listed to capture the documented set.values-kmr(Northern Kurdish) test so 3-letter legacy locales keep getting pruned.Alternatives considered
values-kmr, a real 3-letter legacy locale that must still be pruned. A 2-letter rule would silently skip it.caris a valid ISO 639 code, so a language list would still classifyvalues-caras a locale.Open question (not a blocker)
Could the GlotPress → Android export ever emit other folder names that collide with a non-locale qualifier? If so, we'd just extend the same exclusion list. Confirming the export's folder-naming conventions separately; not a blocker for WordPress-Android (no
values-car).Notes
android_prune_orphaned_translationsaction #734 branch (add/prune-orphaned-translations) so the regression + fix stay contained in one reviewable PR rather than folded into the larger feature PR.