-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Intl] Load locale aliases to support alias fallbacks #26452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
For example, zh_TW is an alias to zh_Hant_TW. Without aliases, zh_TW would fall back to zh (which is incorrect). With aliases loaded, zh_TW will fall back properly to zh_Hant_TW.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I don't understand the internals of this, the change looks correct, all test pass and the new test make sense to me. Thanks Jakub!
@javiereguiluz all our icu data providers use an entry reader to actually read icu data from (currently) json files we bundle with the intl component. The entry reader already supports handling aliases. However, we never told it to use any aliases. Now we do :) |
All reactions
-
👍 1 reaction
Sorry, something went wrong.
…zal) This PR was squashed before being merged into the 2.7 branch (closes #26452). Discussion ---------- [Intl] Load locale aliases to support alias fallbacks | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #21457 | License | MIT | Doc PR | - For example, `zh_TW` is an alias to `zh_Hant_TW`. Without aliases,` zh_TW` would fall back to `zh` (which is incorrect). With aliases loaded, `zh_TW` will fall back properly to `zh_Hant_TW`. Judging by git history this has never worked. ```php \Locale::setDefault('zh'); dump(Intl::getRegionBundle()->getCountryName('AD')); \Locale::setDefault('zh_TW'); dump(Intl::getRegionBundle()->getCountryName('AD')); \Locale::setDefault('zh_Hant_TW'); dump(Intl::getRegionBundle()->getCountryName('AD')); ``` Before: ``` "安道尔" "安道尔" "安道爾" ``` After: ``` "安道尔" "安道爾" "安道爾" ``` All tests are passing, including those from the `intl-data` group. Commits ------- 1debf79 [Intl] Load locale aliases to support alias fallbacks
fabpot
javiereguiluz
Successfully merging this pull request may close these issues.
For example,
zh_TW
is an alias tozh_Hant_TW
. Without aliases,zh_TW
would fall back tozh
(which is incorrect). With aliases loaded,zh_TW
will fall back properly tozh_Hant_TW
.Judging by git history this has never worked.
Before:
After:
All tests are passing, including those from the
intl-data
group.