click-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lorenzo Simionato (JIRA)" <j...@apache.org>
Subject [jira] Created: (CLK-740) More countries in org.apache.click.extras.controlCountrySelect
Date Thu, 16 Dec 2010 12:33:03 GMT
More countries in org.apache.click.extras.controlCountrySelect
--------------------------------------------------------------

                 Key: CLK-740
                 URL: https://issues.apache.org/jira/browse/CLK-740
             Project: Click
          Issue Type: Improvement
          Components: extras
            Reporter: Lorenzo Simionato
            Priority: Minor


>From the description of CountrySelect it says that 
"The country list is not hardcoded but generated by the JDK, i.e. there's an Option for each
country that has a supported Locale from the side of the JDK.".

In the code the list of countries is obtained in the following way:

Locale[] availableLocales = Locale.getAvailableLocales();
for (int i = 0; i < availableLocales.length; i++) {
    final String iso = availableLocales[i].getCountry();
    final String country = availableLocales[i].getDisplayCountry(getLocale());
     ...
}

That returns a limited list of countries. We can change this in the following way to obtain
a more complete list, that is more useful for example
in registration forms:

String[] isoCountries = Locale.getISOCountries();
for (int i = 0; i < isoCountries.length; i++) {
    Locale locale = new Locale("en", isoCountries[i]);
    final String iso = locale.getCountry();
    final String country = locale.getDisplayCountry(getLocale());
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message