Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | yes |
Symfony version | 3.3.8 (but all others I guess, did not check yet) |
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
or fr-FR
.
In my case it's fr-FR
.
Now the CountryType use the Locale::getDefault
. Refs:
- https://github.com/symfony/symfony/blob/v3.3.8/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php#L78
- ...
- https://github.com/symfony/symfony/blob/v3.3.8/src/Symfony/Component/Intl/Data/Provider/RegionDataProvider.php#L67
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 not
with a dash (-
). But the RFC states the locale should use an underscore and not a dash.
Some facts to take in consideration:
- The Translator component use another RFC for the format of the locale. (
fr_FR
); - The Validator component use another RFC for the format of the locale. (
fr_FR
); - It's really weird I'm the first one to hit this issue => Did I miss something ?
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.