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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.3.0-RC1
    • extras
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: