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

Locales specified via command line not recognized

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.1.6, 1.3.0, 1.4.0
    • core-libs
    • beta2
    • generic, x86
    • generic, linux, windows_nt



      Name: clC74495 Date: 06/26/98


      This bug was thrown aside (4097828)
      as you rushed to release jdk1.1.6
      as not being reproduceable but this
      bug exists in jdk1.1.6 as well as
      jdk1.1.5. i don't think this is a
      regression.

      I am currently using Japanese WinNT4.0
      platform and creating a bilingual program
      (Japanese/English). I would like to be able
      to specify the Locale to be used as the
      default from the command line but setting
      the user.language and user.region system
      properties via the command line do not affect
      the default Locale.

      run the program below (in a Japanase environment) as

      java -Duser.language=en -Duser.region=US LocaleTest

      the program recognizes the specified Locale as en_US
      but still uses the Locale ja_JP as its default Locale!

      this causes problems when using internationalization
      in that the resources loaded are the Japanese
      resources, but the system attempts to display
      them in English (resulting in undefined character
      "boxes" all over all of the menus and window
      titles on screen)

      --- source code begin ---

      import java.util.Locale;

      public class LocaleTest
      {

          static public void main(String[] args)
          {
      Locale defLoc = Locale.getDefault();
      String dLang = defLoc.getLanguage();
      String dRegion = defLoc.getCountry();
      System.out.println("Default Locale = "+dLang+"_"+dRegion);

      String language = System.getProperty("user.language", "en");
      String region = System.getProperty("user.region", "US");
      System.out.println("Specified Locale = "+language+"_"+region);
          }
      }

      --- source code end ---
      (Review ID: 30753)
      ======================================================================

            nlindenbsunw Norbert Lindenberg (Inactive)
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: