click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r1054365 - in /click/trunk/click: documentation/docs/roadmap-changes.html extras/src/org/apache/click/extras/control/CountrySelect.java
Date Sun, 02 Jan 2011 08:56:00 GMT
Author: sabob
Date: Sun Jan  2 08:55:59 2011
New Revision: 1054365

URL: http://svn.apache.org/viewvc?rev=1054365&view=rev
Log:
Improved CountrySelect to include more countries. CLK-740

Modified:
    click/trunk/click/documentation/docs/roadmap-changes.html
    click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java

Modified: click/trunk/click/documentation/docs/roadmap-changes.html
URL: http://svn.apache.org/viewvc/click/trunk/click/documentation/docs/roadmap-changes.html?rev=1054365&r1=1054364&r2=1054365&view=diff
==============================================================================
--- click/trunk/click/documentation/docs/roadmap-changes.html (original)
+++ click/trunk/click/documentation/docs/roadmap-changes.html Sun Jan  2 08:55:59 2011
@@ -272,6 +272,11 @@ Action support and light-weight stateful
               [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-695">CLK-695</a>].
           </li>
           <li class="change">
+              Improved CountrySelect to include more countries by using Locale.getISOCountries().
+              This issue was raised and fixed by Lorenzo Simionato
+              [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-740">CLK-740</a>].
+          </li>
+          <li class="change">
               Fixed Control IDs to render underscores instead of periods
               [<a target="_blank" href="https://issues.apache.org/jira/browse/CLK-747">CLK-747</a>].
           </li>

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java?rev=1054365&r1=1054364&r2=1054365&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java Sun Jan
 2 08:55:59 2011
@@ -214,11 +214,14 @@ public class CountrySelect extends Selec
 
         Set<Option> countryList = new TreeSet<Option>(new OptionLabelComparator(getLocale()));
 
-        Locale[] availableLocales = Locale.getAvailableLocales();
+        String[] isoCountries = Locale.getISOCountries();
 
-        for (int i = 0; i < availableLocales.length; i++) {
-            final String iso = availableLocales[i].getCountry();
-            final String country = availableLocales[i].getDisplayCountry(getLocale());
+        Locale userLocale = getLocale();
+
+        for (int i = 0; i < isoCountries.length; i++) {
+            Locale tmpLocale = new Locale("en", isoCountries[i]);
+            final String iso = tmpLocale.getCountry();
+            final String country = tmpLocale.getDisplayCountry(userLocale);
 
             if (StringUtils.isNotEmpty(iso) && StringUtils.isNotEmpty(country)) {
                 countryList.add(new Option(iso, country));



Mime
View raw message