Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Intl] Languages get names returns some alpha3 keys instead of alpha2 #47495

Copy link
Copy link
Closed
@Thorry84

Description

@Thorry84
Issue body actions

Symfony version(s) affected

5.4+

Description

The function getNames in the Intl Languages class states: "Gets the list of language names indexed with alpha2 codes as keys."
However it returns the list of alpha2 languages supplemented with alpha3 languages for which no alpha2 code is available. I think this is due to this change: #33140

This change causes a problem where other code expects to get an alpha2 code, but instead receives an alpha3 code. There seems to be no simple way to exclude the alpha3 codes as there is a getAlpha3Names function, but no getAlpha2Names function.

This also impacts the Symfony Form LanguageType, which uses the getNames function to build the language list. It's docs also specify alpha2 being used.

How to reproduce

var_dump(\Symfony\Component\Intl\Languages::getNames());

This shows key values of 3 letters instead of 2, for example ada for Adangme

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.