Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322324 - Change default locale
Summary: Change default locale
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 2.6.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: Future   Edit
Assignee: Jianchao Li CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-11 04:45 EDT by Pico CLA
Modified: 2011-05-17 03:36 EDT (History)
5 users (show)

See Also:


Attachments
A sample for currency format in gl locale. (3.34 KB, application/octet-stream)
2010-08-18 19:37 EDT, Wei Yan CLA
no flags Details
A sample with 2.6.0 (5.15 KB, application/octet-stream)
2010-08-19 04:34 EDT, Pico CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pico CLA 2010-08-11 04:45:39 EDT
Hi, 

I have a problem with amounts format using "gl" locale.

Birt generates 1,234.46 € instead of 1.234,46 that will be ok. 

If I change the default locale of JVM to "es" that has the same format for dates and amounts that "gl", it neither runs ok. 

Could I change the default locale of Birt with which it had to format the dates and amounts should not find the specified locale ?

Thanks in advance.
Comment 1 Xiaoying Gu CLA 2010-08-12 02:34:55 EDT
I don't quite understand the issue.
You can change the default locale in preference of report design or on the specific dataitem.
You can change the number format to hide the currency symbol.
Comment 2 Pico CLA 2010-08-13 05:24:13 EDT
Sorry if I explained poorly.
I mean to change the default locale using by the ReportEngine, in case that locale specified in the design ("gl") does not exist for the formatting of numbers for example.
"gl" is not a locale included in the java jre, but I have an external library that allows me to incorporate it, including the library in JAVA_HOME/lib/ext. If I run a Java application with the locale "gl" works ok, but BIRT does not, it always format the numbers using the english locale (I suspect it is because the OS is in English but with the locale in Spanish).

I hope I explained better. Thanks again.
Comment 3 Jun Ouyang CLA 2010-08-13 05:36:25 EDT
Pico,

How do you set locale "gl" for a java application? Can you show us the code?
If "gl" is a custom locale, is it possible for us to reproduce this problem by a standard java locale?
Comment 4 Pico CLA 2010-08-13 06:12:52 EDT
Hi, 

public static void main(String [ ] args)
        {
        
        final Locale glLocale = new Locale("gl");        // language = Galician, country = Spain
        final String myDateStr = DateFormat.getDateInstance(DateFormat.FULL, glLocale).format(new Date());
        System.out.println(myDateStr);

    }

This runs ok, but the birt reports don´t format well the date, using the same JVM.

Thanks, a lot. 


(In reply to comment #3)
> Pico,
> 
> How do you set locale "gl" for a java application? Can you show us the code?
> If "gl" is a custom locale, is it possible for us to reproduce this problem by
> a standard java locale?
Comment 5 Pico CLA 2010-08-16 07:23:00 EDT
Hi, 

I install the extesion of http://www.javagalician.org/ in my JVM and the before code runs ok, but in Birt with "gl" locale, dates and numbers had bad format. 

Thanks. 


(In reply to comment #4)
> Hi, 
> 
> public static void main(String [ ] args)
>         {
> 
>         final Locale glLocale = new Locale("gl");        // language =
> Galician, country = Spain
>         final String myDateStr = DateFormat.getDateInstance(DateFormat.FULL,
> glLocale).format(new Date());
>         System.out.println(myDateStr);
> 
>     }
> 
> This runs ok, but the birt reports don´t format well the date, using the same
> JVM.
> 
> Thanks, a lot. 
> 
> 
> (In reply to comment #3)
> > Pico,
> > 
> > How do you set locale "gl" for a java application? Can you show us the code?
> > If "gl" is a custom locale, is it possible for us to reproduce this problem by
> > a standard java locale?
Comment 6 Pico CLA 2010-08-17 06:15:12 EDT
Hi, 

I do this before run, and not works, with "gl", but it runs ok with "es" and "ca".

runAndRenderTask.setLocale(new Locale("gl"));

Thanks.
Comment 7 Pico CLA 2010-08-18 08:09:55 EDT
I did new discoveries...with JDK 1.5.0_13 it runs ok(out of my numbers in report: 1.234,56), with JRE not, and with JDK 1.6 neither(out: 1,234.56). 

It is very strange, Could someone help me, please?

Thank in advance.
Comment 8 Wei Yan CLA 2010-08-18 17:57:12 EDT
After you install the package, do you use the tool in the package to verify if the locale is supported?

I am testing the 1.1 in JDK 1.6.20 (64bit), the verification fails:
---------------------------------------------------
GALICIAN LOCALE gl AVAILABLE BUT NOT CORRECT!!
---------------------------------------------------
---------------------------------------------------
GALICIAN LOCALE gl_ES AVAILABLE BUT NOT CORRECT!!
---------------------------------------------------

Please note that the 1.1 doesn't support JDK1.5 or before.
Comment 9 Wei Yan CLA 2010-08-18 19:35:50 EDT
BIRT need to be enhanced in constructing the DecimalFormatSymbols for different locales. Instead of using new DecimalFormatSymbols(Locale), BIRT should use DecimalFormatSymbols.getInstance(Locale) to get the symbols used in a locale, so 
the user defined symbols (through the SymbolProvider) can be used, see 
http://download-llnw.oracle.com/javase/6/docs/api/java/text/DecimalFormatSymbols.html#getInstance%28java.util.Locale%29

Please note that this API is only provided in JDK1.6, we need check the BIRT specification to see if we can make the change in BIRT 2.6.x.

For a workaround, I think you can define the format pattern explicit for as 'C', see the attached report design.
Comment 10 Wei Yan CLA 2010-08-18 19:37:01 EDT
Created attachment 176952 [details]
A sample for currency format in gl locale.
Comment 11 Pico CLA 2010-08-19 04:32:37 EDT
Thanks Wei Yang,

At first verification after installing the package javagalician was OK.

Are there possibilities the change that you say is for 2.6.1 official release, coul i get any patch?

The report design that you attach was builtwith version 2.6.1 and I have the 2.6.0.
I attacha report design built with 2.6.0  with a data item, an item parameter and a Text item. I need the report to work with three locales that I change in run time ("es", "ca" and "gl") with :

runAndRenderTask.setLocale (new Locale ("gl"));

If I choose locale "gl" for the Data Item and Parameter do not format ok"gl","ca","es." If I select Auto in locale "es" and "ca" well formatted. Any idea?

Another question, do not use BIRT com.ibm.icu for internationalization? in this library already includes the locale "gl."

Anyway I do not understand what I say in the commentary 7, why the jdk 1.5.0_13 work properly?

Again thank you very much.

Greetings.
Comment 12 Pico CLA 2010-08-19 04:34:24 EDT
Created attachment 176970 [details]
A sample with 2.6.0
Comment 13 Pico CLA 2010-08-19 04:37:00 EDT
Anyway I do not understand what I say in the commentary 7, why the jdk 1.5.0_13
 work properly without javagalician package installed? 


(In reply to comment #11)
> Thanks Wei Yang,
> 
> At first verification after installing the package javagalician was OK.
> 
> Are there possibilities the change that you say is for 2.6.1 official release,
> coul i get any patch?
> 
> The report design that you attach was builtwith version 2.6.1 and I have the
> 2.6.0.
> I attacha report design built with 2.6.0  with a data item, an item parameter
> and a Text item. I need the report to work with three locales that I change in
> run time ("es", "ca" and "gl") with :
> 
> runAndRenderTask.setLocale (new Locale ("gl"));
> 
> If I choose locale "gl" for the Data Item and Parameter do not format
> ok"gl","ca","es." If I select Auto in locale "es" and "ca" well formatted. Any
> idea?
> 
> Another question, do not use BIRT com.ibm.icu for internationalization? in this
> library already includes the locale "gl."
> 
> Anyway I do not understand what I say in the commentary 7, why the jdk 1.5.0_13
> work properly?
> 
> Again thank you very much.
> 
> Greetings.
Comment 14 Wenfeng Li CLA 2011-01-19 17:16:29 EST
schedule to 4.0.0 to use the API in JDK 1.6, see comment 9.