-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Intl] Locale::getFallback does not split on dash #24154
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
Comments
For reference, see discussion on #2468 as well |
We could use |
PR more than welcome :) |
This PR was merged into the 2.7 branch. Discussion ---------- [Intl] Fixed support of Locale::getFallback | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #24154 | License | MIT | Doc PR | Commits ------- 2560552 [Intl] Fixed support of Locale::getFallback
Is it possible to get this change into Symfony 4? |
@thejahweh I can see the change in Symfony 4: https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/Intl/Locale.php#L70 |
Hello.
I just hit an issue with the country type and the Intl component.
According to PHP, the first parameter of Locale::setDefault
should be a BCP 47 compliant tag.
So according to the RFC, it should be something like
fr
orfr-FR
.In my case it's
fr-FR
.Now the CountryType use the
Locale::getDefault
. Refs:Then symfony will use will default locale to find the best locale by "fallbacking" on "wider" locale (
fr_FR
->fr
)And here
there is something wrong IMHO. Symfony only try to split the local with an underscore (
_
) and notwith a dash (
-
). But the RFC states the locale should use an underscore and not a dash.Some facts to take in consideration:
fr_FR
);fr_FR
);What I suggest: We could update the
Locale::getFallback
method to support splitting on-
.WDYT? I can make the PR if this RFC is accepted.
I pushed a reproducer
The text was updated successfully, but these errors were encountered: