Uploaded image for project: 'Click'
  1. Click
  2. CLK-740

More countries in org.apache.click.extras.controlCountrySelect

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0-RC1
    • Component/s: extras
    • Labels:
      None

      Description

      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());
      }

        Attachments

          Activity

            People

            • Assignee:
              sabob Bob Schellink
              Reporter:
              fatzeus Lorenzo Simionato
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: