JDK-4472039 : Passing LTR locale to JVM using "-Duser.lang/region" under arabic/Heb OS's fails
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-06-20
  • Updated: 2014-10-24
  • Resolved: 2001-07-20
Related Reports
Duplicate :  
Description

Name: jbT81659			Date: 06/20/2001

Os: Win2000(Eng, Hebrew), Solaris8(Arabic), Windows 95 (Hebrew)
JDK: jdk1.4.0-b67
TestCase: testDate.java and others

Under Arabic/Hebrew localized Operating Systems, JVM does not respect a locale 
passed to it using java -Duser.lang/-Duser.region. and uses the default locale

The following summary describes this bug

This bug affects all localized Hebrew or Arabic OS's

Test case: jCheckBox.java

Default locale: Default locale is not hardcoded in the test case

Tested OS's: Win2000 English, Win2000 Hebrew


Describtion:

Passing an application locale under Win2000 English using: 

java -Duser.language=he -Duser.region=IL jCheckBox

Reults in:

   JVM respects the -Duser.language and -Duser.region settings. 

   Application Component Orientation is RIGHT_TO_LEFT


Executing the application with command:

java jCheckBox

Reults in:

1. Application ComponentOrientation is LEFT_TO_RIGHT 


Passing an application locale under Win2000 Hebrew using: 

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

Results in:

1. JVM DOES NOT respect -Duser.languague and/or -Duser.region


Changing locale value in Regional Settings in Control Panel:

   Changing the regional settings under Windows 2000 Hebrew 
   to "English" and running application using : 

   java jCheckBox 

Results in:

1-   Appliaction Component Orientation will be LEFT_TO_RIGHT

Passing the Hebrew locale to the JVM using the syntax:

     java -Duser.language=he -Duser.region=IL jCheckBox

Results in:

1. Appliaction Component Orientation will be RIGHT_TO_LEFT
   
To reproduce bug:

Windows 2000 English
1- Compile the following code (jCheckBox.java) 
2- Run  the application using "java -Duser.language=en -Duser.region=US jCheckBox"
3- Note that application ComponentOrientation is NOT changed to LEFT_TO_RIGHT
4- run  the appliccation using "java -Duser.language=he -Duser.region=IL jCheckBox"
5- Note that application ComponentOrientation is RIGHT_TO_LEFT

Win2000 English
1- Compile the following code (jCheckBox.java) under Win2000 English
2- run  the appliccation using "java -Duser.language=he -Duser.region=IL jCheckBox"
3- Note that application ComponentOrientation is changed to RIGHT_TO_LEFT
4- run  the appliccation using "java -Duser.language=en -Duser.region=US jCheckBox"
5- Note that application ComponentOrientation is changed to LEFT_TO_RIGHT

------------Code------------------------
/* Copyright (c) Sun Microsystems 1998

$Header: /home-bazelet/sun/src/javaLab/JDK1.4/standard/jCheckBox.java,v 1.1.1.1 2001/06/19 15:01:31 isam Exp $

*/

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.applet.*;
import javax.swing.*;
import java.util.*;

public class jCheckBox extends JApplet
{

        public void init()
        { 
           jCheckBox1 chckbox1 = new jCheckBox1();
           getContentPane().add(chckbox1);
    }
        public static void main(String[] argv)
        {

        JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
        frame.setContentPane(new jCheckBox1());
        frame.pack();
        frame.setVisible(true);
        frame.addWindowListener( new WindowAdapter()
        {
           public void windowClosing( WindowEvent e)
           {
                System.exit(0);
           }
        });
    }
}

class jCheckBox1 extends JPanel
{
        public jCheckBox1()
        {
                JCheckBox Box1, Box2, Box3, Box4, Box5, Box6, Box7, Box8, Box9, Box10; 
        this.setLayout(new GridLayout(11,1));

        Box1 = new JCheckBox("\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631\u0020\u0042\u0049\u0047\u0020\u0052\u0045\u0044\u0020\u0041\u0050\u0050\u004c\u0045\u0053");

        Box2 = new JCheckBox("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038");

        Box3 = new JCheckBox("\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");

        Box4 = new JCheckBox("\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631\u0020\u0042\u0049\u0047\u0020\u0052\u0045\u0044\u0020\u0041\u0050\u0050\u004c\u0045\u0053");
        Box5 = new JCheckBox("\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
        Box6 = new JCheckBox("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038");
        Box7 = new JCheckBox("\u05ea\u05e4\u05d5\u05d6\u05d9\u05dd\u0020\u05d8\u05e2\u05de\u05d9\u05dd\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e");
        Box7.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box8 = new JCheckBox("\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8");
        Box9 = new JCheckBox("\u006c\u0069\u006d\u0065\u0020\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u05d9\u05e7\u05e8\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e");
        Box10 = new JCheckBox("\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8");

        Box1.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box2.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box3.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box4.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box5.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box6.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box8.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box9.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));
        Box10.setFont(new Font("Lucida Sans Regular", Font.PLAIN, 12));

                add(Box1);
                add(Box2);
        add(Box3);
        add(Box4);
        add(Box5);
        add(Box6);
        add(Box7);
        add(Box8);
        add(Box9);
        add(Box10);
        }
}
----------------------------------------
======================================================================

Comments
EVALUATION Routing to i18n for further evaluation, since that group owns the code that reads these properties and computes the default locale. -- mr@eng 2001/6/20 Probably a duplicate of 4152725. norbert.lindenberg@Eng 2001-06-20 ###@###.### confirmed that setting the user.language property now has the desired effect on the component orientation, overriding the host OS locale no matter which one it is. Note that the obsolete user.region and the new user.country and user.variant are not intended to have an effect on the component orientation. norbert.lindenberg@Eng 2001-07-19
19-07-2001