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

LocalBundle country code standard ??? #181

Open
maity-kgz opened this issue Feb 18, 2016 · 7 comments
Open

LocalBundle country code standard ??? #181

maity-kgz opened this issue Feb 18, 2016 · 7 comments

Comments

@maity-kgz
Copy link

If I configure locales in Symfony CMF app/config/parameters.yml with "kg" country code which stands for Kyrgyzstan according to ISO 3166-1 alpha-2 standard than in LocaleBundle switcher i get Congo country which is totally wrong, but in admin panel SonataTranslationBundle shows correct flag of Kyrgyzstan.

I figured out that LocaleBundle uses "ky" code for Kyrgyzstan but according to ISO 3166-1 alpha-2 standard this code is for Cayman Islands. If I use "ky" locale in app/config/parametes.yml than LocaleBundles switcher shows correct Kyrgyzstan but in admin SonataTranslationBundle shows me Cayman Islands flag.

used default params for LocaleBundle:

>  lunetics_locale:

    strict_mode: true

    guessing_order:

        - router

        - cookie

        - browser

    allowed_locales: '%locales%'
@hacfi
Copy link
Collaborator

hacfi commented Feb 18, 2016

@maity-kgz This bundles uses symfony/intl which uses ISO 639-1. Not sure how to deal with this issue though.

@dbu
Copy link
Collaborator

dbu commented Feb 18, 2016

there seem to be other issues with the data symfony/intl is using: symfony/symfony#12583

no idea however if things could be customized/extended/overridden to work around this, or how the root cause could be solved, sorry.

@jakzal
Copy link

jakzal commented Mar 7, 2016

Symfony is merely a consumer of data provided by ICU. According to ICU, kg is a language code for Kongo, while ky is a language code for Kyrgyz. These are ISO-639-1 codes used by Symfony:

The "value" for each locale is either the two letter ISO 639-1 language code (e.g. fr), or the language code followed by an underscore (_), then the ISO 3166-1 alpha-2 country code (e.g. fr_FR for French/France).

@maity-kgz by using kg you're telling Symfony to use Kongo language. You should either use ky or ky_KG. It appears to be a valid locale for Kyrgyztan. Locale for Kayman Islands is en_KY.

@maity-kgz
Copy link
Author

@jakzal all you said is valid for Symfony2 forms but not to this issue.
Thing is that using ky_KG is not solve the issue. Because LocalBundle is not support that type of code.

@jakzal
Copy link

jakzal commented Mar 9, 2016

What do you mean it's not supported?

The following code returns Kyrgyz (Kyrgyzstan):

echo \Symfony\Component\Intl\Intl::getLocaleBundle()->getLocaleName('ky_KG');

@jakzal
Copy link

jakzal commented Mar 9, 2016

Just realised you were talking about LocaleBundle from this repository. I never used it and perhaps it needs fixing (maybe it confuses the country code with locale). I only explained there's nothing wrong with Symfony's components (as this issue was linked to the Symfony's issue).

@dbu
Copy link
Collaborator

dbu commented Mar 25, 2016

thanks @jakzal

@maity-kgz if you have time to dig though this with the pointers jakub gave, i am glad to help reviewing a pull request to fix this. if we do any duplication in here where we could use the symfony intl component, we should go for symfony intl...

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

4 participants