-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RFC] Exclude locales from language codes #33146
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
I disagree with this. I agree it could be useful to exclude it from a language drop down list in a form component. Here is the full list of the 22 entries we are talking about:
How can you get f.ex. "Dari", "Traditional Chinese" or "Simplified Chinese" without this list? It is also very useful as a reference to which language and locale combinations that actually defines a separate language. |
|
Or would you list f.ex. "Flemish" as "Dutch (Belgium)" |
Using "Dutch (Belgium) / French (Belgium) is common yes (at least in technical implementations), but i agree these names (e.g. Flemish) are also common in general. So the data has value, fair :)
This takes a ISO language code, However, we could leverage this data when translating a locale, e.g. a lookup for specialized language names around here:
I agree for the locale selector |
What about these lines in the list of locales: symfony/src/Symfony/Component/Intl/Resources/data/locales/en.json Lines 582 to 590 in 50c5911
It clearly shows that |
Same for |
'es_419' => 'Latin American Spanish', are also entries that does not follow the language_country pattern. I think all this is data that is worth exposing to the programmers. |
they do :) |
Yes, but my point is that this is special language/region combinations that has their own names as languages in the ISO 639-1 specification. I think we should keep them. Otherwise it will also be a BC break. |
true, we removed codes before though. But yes, it's tricky and technically a BC break / but maybe a bugfix also 😓 From a best practice point of view, i'd argue the usefulness of the language selector itself. Using the locale selector avoids these issues and will provide the language code as well (but based on context). |
I am sorry, I do not follow you. What do you mean by "language selector", "language code" and "locale selector"? |
see e.g. #28833 when we exclude "language codes" from the Intl component, we directly impact the form type (what i call the language selector) |
Well, the form type can implement it's own filter. This is useful in many other programming situations than just a language selector in a form. What is then the "locale selector" you are talking about? |
But ISO 639-1 claims that |
The locale form type :) not sure the form should filter the list itself, it's the same data domain. So the question should be answered in the Intl component IMHO.
Can you share a reference for that? |
Also, locale names are not the same as language names. If I want a name for a language, I would not expect to have to look for it among the locale names. |
but a locale name includes the language name
what about updating |
Ok. Good that we got that cleared up.
I think it should filter the list, if it finds it useful to have a shorter list. Then other use cases can benefit from the full list.
Sorry, I guess you are right about that. It is not a part of the standard. I assumed it was because it was in the data we got from the source bundle. I guess this is the authorative list for the ISO 639 standard: http://www.loc.gov/standards/iso639-2/php/code_list.php |
Ok. Fair enough. (But a bit roundabout way to get the language name.)
Yes, I find that reasonable. It should take a language code or a locale and return the best fit for a language that it can find. |
We could also either add an argument to |
…lized language names) (ro0NL) This PR was merged into the 4.4 branch. Discussion ---------- [Intl] Excludes locale from language codes (split localized language names) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #33146 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> (includes #33140) Commits ------- 1a9f517 [Intl] Excludes locale from language codes (split localized language names)
In #33136 @TerjeBr discovered a few weird "language codes", e.g.
symfony/src/Symfony/Component/Intl/Resources/data/languages/en.json
Lines 148 to 151 in 50c5911
These are a combination of language code + country code, thus a locale actually.
I don't think one should be able to select e.g.
en_AU
as a language code, that would be unexpected data. In this case one should simply selecten
(English) for a language, and e.g. compose it with a known country code to get a locale, or select a pre-defined locale from the list.So ultimately this data would be replaced by the locale domain, e.g.
symfony/src/Symfony/Component/Intl/Resources/data/locales/en.json
Line 102 in 50c5911
This means we lose some specific language name translations, but i tend to believe we should do it. (IMHO it's not worth to preserve
Australian English
somewhere when translating a locale,English (Australia)
could be sufficient)The text was updated successfully, but these errors were encountered: