Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
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 left a comment
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!
jakzal commentedMar 8, 2018
@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 :) |
…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
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.