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

Locale.getISO3Languages() works wrong

XMLWordPrintable

    • 1.2beta4
    • sparc
    • solaris_2.5
    • Verified



      Name: avC70361 Date: 03/11/98



        The java.util.Locale.getISO3Languages() doesn't provide three letter codes for
      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 a test demonstrating the bug:
      --------GetISO3LanguageTest.java-------
      import java.util.Locale;
      import java.util.MissingResourceException;

      public class GetISO3LanguageTest {

        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[]) {
          boolean printed = false;
          for(int i = 0; i < langCodes.length; i++) {
            try {
              new Locale(langCodes[i], "").getISO3Language();
            } catch(MissingResourceException e) {
              if (!printed) {
                System.out.println("Languages for which three letter ISO code is not found :");
                System.out.print(langCodes[i]);
                printed = true;
              } else {
                System.out.print(", " + langCodes[i]);
              }
            }
          }

        }
      }
      -----------The test output----------
      > java GetISO3LanguageTest
      Languages for which three letter ISO code is not found :
      > java GetISO3LanguageTest
      Languages for which three letter ISO code is not found :
      aa, ab, af, am, as, ay, az, ba, bh, bi, bn, bo, br, co, cy, dz, eo, eu, fa, fj, fo, fy, ga, gd, gl, gn, gu, ha, he, hi, hy, ia, id, ie, ik, iu, jw, ka, kk, kl, km, kn, ks, ku, ky, la, ln, lo, mg, mi, ml, mn, mo, mr, ms, mt, my, na, ne, oc, om, or, pa, ps, qu, rm, rn, rw, sa, sd, sg, si, sm, sn, so, ss, st, su, sw, ta, te, tg, ti, tk, tl, tn, to, ts, tt, tw, ug, ur, uz, vi, vo, wo, xh, yi, yo, za, zu

      ======================================================================

            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: