[Intl] Load locale aliases to support alias fallbacks#26452
Closed
jakzal wants to merge 3 commits intosymfony:2.7from
Closed
[Intl] Load locale aliases to support alias fallbacks#26452jakzal wants to merge 3 commits intosymfony:2.7from
jakzal wants to merge 3 commits intosymfony:2.7from
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.
javiereguiluz
approved these changes
Mar 8, 2018
Member
There was a problem hiding this comment.
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!
Contributor
Author
|
@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 :) |
Sorry, something went wrong.
fabpot
approved these changes
Mar 8, 2018
jakzal
added a commit
that referenced
this pull request
Mar 9, 2018
…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
This was referenced Apr 2, 2018
Merged
Merged
Merged
Merged
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.
For example,
zh_TWis an alias tozh_Hant_TW. Without aliases,zh_TWwould fall back tozh(which is incorrect). With aliases loaded,zh_TWwill 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-datagroup.