Skip to content
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

request: include native list #16

Open
dicktyr opened this issue Mar 7, 2020 · 3 comments
Open

request: include native list #16

dicktyr opened this issue Mar 7, 2020 · 3 comments

Comments

@dicktyr
Copy link

dicktyr commented Mar 7, 2020

a "native" list with each language in its native language and script would be useful

e.g.

ru русский
sa संस्कृतम्
en English
@fabswt
Copy link

fabswt commented Nov 20, 2020

Any reason my message from yesterday got removed?

@fabswt
Copy link

fabswt commented Nov 23, 2020

I came up with this:

/**
 * Let's get the language code + English name + Endonym (the language's name in
 * the language) for ALL locales supported by PHP.
 */
$languages = ResourceBundle::getLocales('');

header("Content-Type: text/plain");
echo "CODE\tLANGUAGE_NAME\tENDONYM\n";

foreach($languages as $language) {
    echo
      $language
      . "\t"
      . ucfirst(Locale::getDisplayName($language, 'en-US'))
      . "\t"
      . mb_convert_case(
        Locale::getDisplayName($language, $language),
        MB_CASE_TITLE,
        'UTF-8'
      )
      . "\n";
}

It will return:

CODE	LANGUAGE_NAME	ENDONYM
af	Afrikaans	Afrikaans
af_NA	Afrikaans (Namibia)	Afrikaans (Namibië)
af_ZA	Afrikaans (South Africa)	Afrikaans (Suid-Afrika)
agq	Aghem	Aghem
agq_CM	Aghem (Cameroon)	Aghem (Kàmàlûŋ)
ak	Akan	Akan
ak_GH	Akan (Ghana)	Akan (Gaana)
am	Amharic	አማርኛ
am_ET	Amharic (Ethiopia)	አማርኛ (ኢትዮጵያ)
ar	Arabic	العربية
ar_001	Arabic (World)	العربية (العالم)
ar_AE	Arabic (United Arab Emirates)	العربية (الإمارات العربية المتحدة)
...

@dicktyr
Copy link
Author

dicktyr commented Nov 23, 2020

thank you for the work around :}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants