Proposed solution for the old and known English locale bug

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposed solution for the old and known English locale bug

Jacopo Cappellato
In the attached patch there is a very simple way to fix the old and
known bug that makes impossible to display the English labels when OFBiz
is run in an operating system with a system language (different from
English) that is available in the OFBiz ui lables property files.
The bug is caused by the way the Java localization routines search for
localized files and by the fact that in OFBiz we don't maintain the en_EN
files, because the labels are in the default properties files (without
locale extension).

For example, if I run OFbiz in an operating system with locale it_IT, and
I set the language session to en_EN, the labels are shown in Italian
because the en_EN files are not found and so (before using the default
labels without locale suffix) the Java localization routine retrieves the
system langage (it_IT) and searches for property files with the it_IT
suffix (and finds them).

The proposed solution (that Jacques LeRoux already suggested in an old
Jira issue) is to use the -Duser.language=en parameter when invoking the
java command (in the OFBiz startup files): in this way the default system
locale will be the English one, and everything will work as expected... I
don't think it is a bad solution, in fact it is correct to set the JVM in
which OFBiz is running to the same locale of the default language files of
OFBiz.

Can I commit the patch?

Jacopo


Index: startofbiz.bat
===================================================================
--- startofbiz.bat (revision 452073)
+++ startofbiz.bat (working copy)
@@ -16,8 +16,8 @@
 REM #####################################################################
 ECHO ON

-"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -jar ofbiz.jar >
framework\logs\console.log
+"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar
ofbiz.jar > framework\logs\console.log

 REM This one is for more of a debugging mode
-REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Xdebug -Xnoagent
-Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
ofbiz.jar > framework\logs\console.log
+REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -Xdebug
-Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
ofbiz.jar > framework\logs\console.log

Index: startofbiz.sh
===================================================================
--- startofbiz.sh (revision 452073)
+++ startofbiz.sh (working copy)
@@ -30,7 +30,8 @@
 #DEBUG="-Dsun.rmi.server.exceptionTrace=true"
 #RMIIF="-Djava.rmi.server.hostname=<set your IP address here>"
 MEMIF="-Xms128M -Xmx256M"
-VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN"
+LANGUAGE="-Duser.language=en"
+VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN $LANGUAGE"

 # Worldpay Config
 #VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar $VMARGS"



Reply | Threaded
Open this post in threaded view
|

Re: Proposed solution for the old and known English locale bug

Jacques Le Roux
Administrator
+1

I already use this setting for months now without any problem at all.

Jacques

----- Original Message -----
From: "Jacopo Cappellato" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, October 03, 2006 9:06 AM
Subject: Proposed solution for the old and known English locale bug


> In the attached patch there is a very simple way to fix the old and
> known bug that makes impossible to display the English labels when OFBiz
> is run in an operating system with a system language (different from
> English) that is available in the OFBiz ui lables property files.
> The bug is caused by the way the Java localization routines search for
> localized files and by the fact that in OFBiz we don't maintain the en_EN
> files, because the labels are in the default properties files (without
> locale extension).
>
> For example, if I run OFbiz in an operating system with locale it_IT, and
> I set the language session to en_EN, the labels are shown in Italian
> because the en_EN files are not found and so (before using the default
> labels without locale suffix) the Java localization routine retrieves the
> system langage (it_IT) and searches for property files with the it_IT
> suffix (and finds them).
>
> The proposed solution (that Jacques LeRoux already suggested in an old
> Jira issue) is to use the -Duser.language=en parameter when invoking the
> java command (in the OFBiz startup files): in this way the default system
> locale will be the English one, and everything will work as expected... I
> don't think it is a bad solution, in fact it is correct to set the JVM in
> which OFBiz is running to the same locale of the default language files of
> OFBiz.
>
> Can I commit the patch?
>
> Jacopo
>
>
> Index: startofbiz.bat
> ===================================================================
> --- startofbiz.bat (revision 452073)
> +++ startofbiz.bat (working copy)
> @@ -16,8 +16,8 @@
>  REM #####################################################################
>  ECHO ON
>
> -"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -jar ofbiz.jar >
> framework\logs\console.log
> +"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar
> ofbiz.jar > framework\logs\console.log
>
>  REM This one is for more of a debugging mode
> -REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Xdebug -Xnoagent
> -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
> ofbiz.jar > framework\logs\console.log
> +REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -Xdebug
> -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
> ofbiz.jar > framework\logs\console.log
>
> Index: startofbiz.sh
> ===================================================================
> --- startofbiz.sh (revision 452073)
> +++ startofbiz.sh (working copy)
> @@ -30,7 +30,8 @@
>  #DEBUG="-Dsun.rmi.server.exceptionTrace=true"
>  #RMIIF="-Djava.rmi.server.hostname=<set your IP address here>"
>  MEMIF="-Xms128M -Xmx256M"
> -VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN"
> +LANGUAGE="-Duser.language=en"
> +VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN $LANGUAGE"
>
>  # Worldpay Config
>  #VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar $VMARGS"
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Proposed solution for the old and known English locale bug

David E Jones-2
In reply to this post by Jacopo Cappellato

I think that's fine. It has minimal impact on things, well really no  
significant impact for most users except to correct this issue but  
change the default locale.

Hopefully at some point we'll be able to change the  
internationalization code to not use the PITA Java ResourceBundle  
stuff... and then these problems will just disappear... ;)

-David


On Oct 3, 2006, at 8:06 AM, Jacopo Cappellato wrote:

> In the attached patch there is a very simple way to fix the old and
> known bug that makes impossible to display the English labels when  
> OFBiz
> is run in an operating system with a system language (different from
> English) that is available in the OFBiz ui lables property files.
> The bug is caused by the way the Java localization routines search for
> localized files and by the fact that in OFBiz we don't maintain the  
> en_EN
> files, because the labels are in the default properties files (without
> locale extension).
>
> For example, if I run OFbiz in an operating system with locale  
> it_IT, and
> I set the language session to en_EN, the labels are shown in Italian
> because the en_EN files are not found and so (before using the default
> labels without locale suffix) the Java localization routine  
> retrieves the
> system langage (it_IT) and searches for property files with the it_IT
> suffix (and finds them).
>
> The proposed solution (that Jacques LeRoux already suggested in an old
> Jira issue) is to use the -Duser.language=en parameter when  
> invoking the
> java command (in the OFBiz startup files): in this way the default  
> system
> locale will be the English one, and everything will work as  
> expected... I
> don't think it is a bad solution, in fact it is correct to set the  
> JVM in
> which OFBiz is running to the same locale of the default language  
> files of
> OFBiz.
>
> Can I commit the patch?
>
> Jacopo
>
>
> Index: startofbiz.bat
> ===================================================================
> --- startofbiz.bat (revision 452073)
> +++ startofbiz.bat (working copy)
> @@ -16,8 +16,8 @@
>  REM  
> #####################################################################
>  ECHO ON
>
> -"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -jar ofbiz.jar >
> framework\logs\console.log
> +"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar
> ofbiz.jar > framework\logs\console.log
>
>  REM This one is for more of a debugging mode
> -REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Xdebug -Xnoagent
> -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
> ofbiz.jar > framework\logs\console.log
> +REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -
> Xdebug
> -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
> ofbiz.jar > framework\logs\console.log
>
> Index: startofbiz.sh
> ===================================================================
> --- startofbiz.sh (revision 452073)
> +++ startofbiz.sh (working copy)
> @@ -30,7 +30,8 @@
>  #DEBUG="-Dsun.rmi.server.exceptionTrace=true"
>  #RMIIF="-Djava.rmi.server.hostname=<set your IP address here>"
>  MEMIF="-Xms128M -Xmx256M"
> -VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN"
> +LANGUAGE="-Duser.language=en"
> +VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN $LANGUAGE"
>
>  # Worldpay Config
>  #VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar  
> $VMARGS"
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Proposed solution for the old and known English locale bug

Jacopo Cappellato
Ok,

this is now in svn rev. 452792

Jacopo


David E Jones wrote:

>
> I think that's fine. It has minimal impact on things, well really no
> significant impact for most users except to correct this issue but
> change the default locale.
>
> Hopefully at some point we'll be able to change the internationalization
> code to not use the PITA Java ResourceBundle stuff... and then these
> problems will just disappear... ;)
>
> -David
>
>
> On Oct 3, 2006, at 8:06 AM, Jacopo Cappellato wrote:
>
>> In the attached patch there is a very simple way to fix the old and
>> known bug that makes impossible to display the English labels when OFBiz
>> is run in an operating system with a system language (different from
>> English) that is available in the OFBiz ui lables property files.
>> The bug is caused by the way the Java localization routines search for
>> localized files and by the fact that in OFBiz we don't maintain the en_EN
>> files, because the labels are in the default properties files (without
>> locale extension).
>>
>> For example, if I run OFbiz in an operating system with locale it_IT, and
>> I set the language session to en_EN, the labels are shown in Italian
>> because the en_EN files are not found and so (before using the default
>> labels without locale suffix) the Java localization routine retrieves the
>> system langage (it_IT) and searches for property files with the it_IT
>> suffix (and finds them).
>>
>> The proposed solution (that Jacques LeRoux already suggested in an old
>> Jira issue) is to use the -Duser.language=en parameter when invoking the
>> java command (in the OFBiz startup files): in this way the default system
>> locale will be the English one, and everything will work as expected... I
>> don't think it is a bad solution, in fact it is correct to set the JVM in
>> which OFBiz is running to the same locale of the default language
>> files of
>> OFBiz.
>>
>> Can I commit the patch?
>>
>> Jacopo
>>
>>
>> Index: startofbiz.bat
>> ===================================================================
>> --- startofbiz.bat    (revision 452073)
>> +++ startofbiz.bat    (working copy)
>> @@ -16,8 +16,8 @@
>>  REM
>> #####################################################################
>>  ECHO ON
>>
>> -"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -jar ofbiz.jar >
>> framework\logs\console.log
>> +"%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -jar
>> ofbiz.jar > framework\logs\console.log
>>
>>  REM This one is for more of a debugging mode
>> -REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Xdebug -Xnoagent
>> -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
>> ofbiz.jar > framework\logs\console.log
>> +REM "%JAVA_HOME%\bin\java" -Xms256M -Xmx512M -Duser.language=en -Xdebug
>> -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar
>> ofbiz.jar > framework\logs\console.log
>>
>> Index: startofbiz.sh
>> ===================================================================
>> --- startofbiz.sh    (revision 452073)
>> +++ startofbiz.sh    (working copy)
>> @@ -30,7 +30,8 @@
>>  #DEBUG="-Dsun.rmi.server.exceptionTrace=true"
>>  #RMIIF="-Djava.rmi.server.hostname=<set your IP address here>"
>>  MEMIF="-Xms128M -Xmx256M"
>> -VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN"
>> +LANGUAGE="-Duser.language=en"
>> +VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN $LANGUAGE"
>>
>>  # Worldpay Config
>>  #VMARGS="-Xbootclasspath/p:applications/accounting/lib/cryptix.jar
>> $VMARGS"
>>
>>
>>
>