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

System property user.language and Locales not connected anymore in JDK1.1.5

    XMLWordPrintable

Details

    Description



      Name: rm29839 Date: 12/08/97


      This is a JDK1.1.5 bug not JDK1.1.4 (there is no
      JDK1.1.5 option on your bug report page)

      (This bug report actually contains 2 related
      bugs)

      I'm writing bilingual applications and was
      using the java command line option -Duser.language=
      to specify which language I wanted things
      to be displayed in. This was working fine in
      JDK1.1.4. With JDK1.1.5 however, the system
      doesn't seem to recognize this parameter any
      more and my default locale (japanese) is
      always returned via Frame.getLocale().

      Furthermore, when I try to force the english
      resource bundle to be loaded (using Locale.ENGLISH),
      the Japanese Locale shows up anyway.

      (btw, Bug Id: 4093632, Foreign language property
      resource bundles aren't loaded correctly, still
      isn't fixed)


      anyway, here's my sample source code:

      ---begin
      import java.util.*;
      import java.awt.*;

      public class TestPropBundle
      {
      public static void main(String[] args)
      {
      Frame win = new Frame();
      Locale loc = win.getLocale();
      if (loc == null)
      {
      System.out.println("no locale?!");
      loc = Locale.ENGLISH;
      }
      System.out.println("Local language = "+loc.getLanguage());

      ResourceBundle rb = ResourceBundle.getBundle("TestProps",Locale.ENGLISH);
      //ResourceBundle rb = ResourceBundle.getBundle("TestProps",Locale.loc);
      String s = rb.getString("Title");
      System.out.println("Title = "+s);
      win.setTitle(s);

      win.setSize(400,300);
      win.setVisible(true);
      }
      }
      ---end

      and the two property files
      ---TestProps.properties begin
      Title=This is my TITLE
      ---end

      ---TestProps_ja.properties begin
      Title=‚±‚ꂪƒ^ƒCƒgƒ‹‚Å‚·
      ---end


      here's a few things to try:
      1)run this app in a Japanese environment
      2)if all you have is an English environment,
      change the Locale.ENGLISH references in the
      program to a foreign locale and run the program
      using the -Duser.language=<the foreign language>
      (you'll have to make the appropriate property
      files for the foreign languages, and you might
      want to make the default property file a
      foreign file instead of the english one i provided)
      3)delete the various property files, one at a time
      to see which file is loaded.

      there is definitely a problem unless
      there has been a change in the specifications
      for user languages and/or Locales.
      (There was no mention in the CHANGES file
      regarding locales or internationalization, so
      i imagine this was some sort of a secret "fix")
      (Review ID: 21349)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              rgillamsunw Richard Gillam (Inactive)
              rmandelsunw Ronan Mandel (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: