Skip to content

[intl] Get all language names with the country language #31562

@lsv

Description

@lsv

Description

Lets say you have a language selector, now you are on the english site, so all the languages are in english fx

  • Danish
  • French
  • Russian

Now you select Russian, now the dropdown will look something like this

  • английский
  • датский
  • французский

Instead it would be lovely to have a dropdown that always look something like this

  • Dansk
  • Français
  • Pусский

Example

$locales = Intl::getLocaleBundle()->getLocaleNamesNotTranslated();
dump($locales);
....
"ru" => "русский",
"da" => "dansk",
"fr" => "français",
....

It would be exactly like doing this

\Locale::setDefault('fr');
$locales = Intl::getLocaleBundle()->getLocaleNames();
$french = $locales['fr'];

\Locale::setDefault('ru');
$locales = Intl::getLocaleBundle()->getLocaleNames();
$russian = $locales['ru'];

\Locale::setDefault('da');
$locales = Intl::getLocaleBundle()->getLocaleNames();
$danish = $locales['da'];

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