umpirsky / country-list

:globe_with_meridians: List of all countries with names and ISO 3166-1 codes in all languages and data formats.
MIT License
5.18k stars 1.55k forks source link

zh-CN vs zh_CN? #45

Closed mendrinos closed 8 years ago

mendrinos commented 9 years ago

My locale for Chinese is: zh-CN and your folder name is: zh_CN.

Any ideas on which is the best way to address this?

What I am getting is: Unable to load the country data file "/home/vagrant/development/engine/vendor/umpirsky/country-list/country/cldr/zh-CN/country.php"

umpirsky commented 9 years ago

Hi, thanks for reporting.

Where do you get this error? Can you provide a trace, or how to reproduce?

mendrinos commented 9 years ago

screen shot 2015-10-06 at 9 24 12 am

This is my locale definition, and googled it a bit and found that the dash '-' is better than the underscore '_'..

so the usage of the country list is for a drop down for country selections:

<select id="company_country_code" name="company_country_code">
    @foreach (Countries::getList(App::getLocale()) as $key => $country) // this is where it breaks
        <option value="{{{$key}}}"@if(GeoIP::getLocation()['isoCode'] == $key) selected="selected" @endif>{{{$country}}}</option>
    @endforeach
</select>
umpirsky commented 9 years ago

Well, this is just a convention.

You can also try ICU https://github.com/umpirsky/country-list/blob/master/country/icu/en/country.csv.