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

No support for xx-xx style locale codes (en-US, zh-TW etc.) #854

Closed
ghost opened this issue May 28, 2016 · 9 comments
Closed

No support for xx-xx style locale codes (en-US, zh-TW etc.) #854

ghost opened this issue May 28, 2016 · 9 comments

Comments

@ghost
Copy link

ghost commented May 28, 2016

I discovered this issue when I was playing around with langswitcher plugin. I noticed that xx-xx style locales doesn't show up on front-end and after further investigation in this topic @rhukster pointed me to this:

Grav\Common\Languages\LanguageCodes::getNames() only knows how to lookup xx style language codes. This would have to be improved to support xx-xx styles too.

https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Language/LanguageCodes.php

@ghost
Copy link
Author

ghost commented May 28, 2016

Here are the most common locales, widely supported by systems and platforms out there:

Description Locale code
English (American) en-US
English (British) en-GB
English (Australian) en-AU
English (Canadian) en-CA
French (Canadian) fr-CA
Chinese (Simplified, PRC) zh-CN
Chinese (Simplified, Singapore) zh-SG
Chinese (Traditional, Taiwan) zh-TW
Chinese (Traditional, Hong Kong S.A.R.) zh-HK
Chinese (Traditional, Macao S.A.R.) zh-MO

@rhukster
Copy link
Member

rhukster commented May 28, 2016

I need to find a list of all ISO 639-1 (xx) and 639-2 (xxx) but with an appropriate native language name.

Then I also need to cross correlate this with a list of locale-based names (en-GB, en-US, zh-CN, zh-TW, etc) but these need to have appropriate native names too.

This is not easy to find!

Links to info I've found far:

https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
https://www.loc.gov/standards/iso639-2/php/code_list.php
http://www.lingoes.net/en/translator/langcode.htm
https://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx

So far i've been able to find resources to ISO 639-1 and 639-2, but nothing to locale-based names with native languages.

@rhukster
Copy link
Member

@rhukster
Copy link
Member

rhukster commented May 28, 2016

@rhukster
Copy link
Member

I've released an update for this plugin that causes the languages to be displayed with suffix in parens:

English (gb) English (us) English 

This is not the final solution. A proper update to the array with more local languages is the ideal solution, but this will at least work for the time being.

@rhukster
Copy link
Member

Fixed for next Grav release: d7f286f

@ghost
Copy link
Author

ghost commented May 29, 2016

@rhukster could you also add support for zh-TW & zh-CN in next release?

@rhukster
Copy link
Member

@manuel-84
Copy link

Hi @rhukster , is it possible to add custom languages not defined into LanguageCodes.php without editing the core?

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

No branches or pull requests

2 participants