Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4118587

Locale.getISOLanguages() misses some languages

XMLWordPrintable

    • 1.2beta4
    • sparc
    • solaris_2.5
    • Verified



      Name: avC70361 Date: 03/11/98



        The java.util.Locale.getISOLanguages() misses some languages which are ISO 639
      according to the URL provided by documentation (http://www.ics.uci.edu/pub/ietf/
      http/related/iso639.txt).

      Here is the test demonstrating the bug.
      ---------------LocaleTest.java----------
      import java.util.Locale;

      public class LocaleTest {

        static final String[] langCodes = {
          "aa", "ab", "af", "am", "ar", "as", "ay", "az",
          "ba", "be", "bg", "bh", "bi", "bn", "bo", "br",
          "ca", "co", "cs", "cy",
          "da", "de", "dz",
          "el", "en", "eo", "es", "et", "eu",
          "fa", "fi", "fj", "fo", "fr", "fy",
          "ga", "gd", "gl", "gn", "gu",
          "ha", "he", "hi", "hr", "hu", "hy",
          "ia", "id", "ie", "ik", "is", "it", "iu",
          "ja", "jw",
          "ka", "kk", "kl", "km", "kn", "ko", "ks", "ku", "ky",
          "la", "ln", "lo", "lt", "lv",
          "mg", "mi", "mk", "ml", "mn", "mo", "mr", "ms", "mt", "my",
          "na", "ne", "nl", "no",
          "oc", "om", "or",
          "pa", "pl", "ps", "pt",
          "qu",
          "rm", "rn", "ro", "ru", "rw",
          "sa", "sd", "sg", "sh", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "su", "sv", "sw",
          "ta", "te", "tg", "th", "ti", "tk", "tl", "tn", "to", "tr", "ts", "tt", "tw",
          "ug", "uk", "ur", "uz",
          "vi", "vo",
          "wo",
          "xh",
          "yi", "yo",
          "za", "zh", "zu"
        };

        public static void main(String args[]) {
          String languages[] = Locale.getISOLanguages();
          boolean printed = false;

          for(int i = 0; i < langCodes.length; i++) {
            boolean found = false;

            for(int j = 0; j < languages.length; j++) {
              if (langCodes[i].equals(languages[j])) {
                found = true;
                break;
              }
            }

            if (!found) {
              if (!printed) {
                System.out.println("Locale.getISOLanguages() misses languages :");
                printed = true;
              }
              System.out.println(langCodes[i]);
            }
          }

        }
      }
      ------------------The test output------------
      > java LocaleTest
      Locale.getISOLanguages() misses languages :
      he
      id
      iu
      ug
      yi
      za
      -----------------
      ======================================================================

            rgillamsunw Richard Gillam (Inactive)
            ovlasov Oleksandr Vlasov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: