8000 [RFC][Intl] Support alias locales by default · Issue #31022 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[RFC][Intl] Support alias locales by default #31022

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

Closed
ro0NL opened this issue Apr 8, 2019 · 0 comments
Closed

[RFC][Intl] Support alias locales by default #31022

ro0NL opened this issue Apr 8, 2019 · 0 comments
Labels
Intl RFC RFC = Request For Comments (proposals about features that you want to be discussed)

Comments

@ro0NL
Copy link
Contributor
ro0NL commented Apr 8, 2019

In #28846 i noticed the following logic:

if (!isset($locales[$value]) && !\in_array($value, $localeBundle->getAliases(), true)) {

Here the LocaleValidator allows both locales and aliases. I think it makes sense.

I propose to support aliases by default in the new Locales data accessor

  • Locales::exists($alias)
  • Locales::getName($alias)
  • Locales::getAliased($alias): ?string
@ro0NL ro0NL changed the title [RFC] Support alias locales by default [RFC][Intl] Support alias locales by default Apr 8, 2019
@chalasr chalasr added Intl RFC RFC = Request For Comments (proposals about features that you want to be discussed) labels Apr 8, 2019
@fabpot fabpot closed this as completed May 6, 2019
fabpot added a commit that referenced this issue May 6, 2019
This PR was squashed before being merged into the 4.3-dev branch (closes #31354).

Discussion
----------

[Intl][Validator] Handle alias locales/timezones

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes (including intl-data group)
| Fixed tickets | #31022
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

both timezones and locales have aliases (either thru deprecation/migration/etc.)

for locales we compile a mapping, for timezones we dont. yet we can benefit partial alias support thru DateTimeZone, which knows about most timezone IDs already.

both the timezone + locale validator already support aliases. Connsequently, we should support aliases in  `Timezones::exists()`  + `Locales::exists()` as well IMHO.

so far so good; the catch is; with this PR `Locales::getName()` supports aliases, whereas `Timezones::getName()` doesnt. I think it's reasonable for now, until we compile the timezone mapping so we can widen the timezone ID conversion here.

Commits
-------

0a9be0d [Intl][Validator] Handle alias locales/timezones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Intl RFC RFC = Request For Comments (proposals about features that you want to be discussed)
Projects
None yet
Development

No branches or pull requests

3 participants
0