Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333099

Summary: Mixture of localisation resources in the same report
Product: z_Archived Reporter: dmtran <dmtran>
Component: BIRTAssignee: Jun Ouyang <jouyang>
Status: VERIFIED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, jouyang
Version: 2.6.1   
Target Milestone: 3.7.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard: Obsolete
Attachments:
Description Flags
My Report design
none
simple java file
none
example report with resources none

Description dmtran CLA 2010-12-22 10:41:21 EST
Build Identifier: 20100617-1415

We have 2 resources : myresource_en.properties and myresource_fr.properties
When generating the report, we set the locale as English :
    runTask.setLocale(ULocale.ENGLISH);
All labels in the Master page got from myresource_en.properties and all labels in the Layout got from myresource_fr.properties
We expect all labels must be in myresource_en.properties

When we set the locale as French (runTask.setLocale(ULocale.FRENCH);), then all labels are correctly in French from myresource_fr.properties



Reproducible: Always
Comment 1 dmtran CLA 2010-12-22 10:43:12 EST
Created attachment 185716 [details]
My Report design
Comment 2 Xiaoying Gu CLA 2011-02-23 05:25:17 EST
what's the locale of your machine?
Comment 3 dmtran CLA 2011-02-23 05:50:09 EST
(In reply to comment #2)
> what's the locale of your machine?

The locale of my machine is French
Comment 4 Xiaoying Gu CLA 2011-02-28 02:04:42 EST
I can not reproduce this issue in the 2.6.0 release build.

Simple java file and sample report is attached. Both labels in masterpage and report body were localized correctly.
Comment 5 Xiaoying Gu CLA 2011-02-28 02:05:18 EST
Created attachment 189910 [details]
simple java file
Comment 6 Xiaoying Gu CLA 2011-02-28 02:05:42 EST
Created attachment 189911 [details]
example report with resources
Comment 7 dmtran CLA 2011-02-28 05:49:26 EST
(In reply to comment #4)
> I can not reproduce this issue in the 2.6.0 release build.
> 
> Simple java file and sample report is attached. Both labels in masterpage and
> report body were localized correctly.

I find something new.
I use the engine to make the report in 2 steps :
1. Create the doc file with the command :
   runTask.run(docFileName);
2. Render the pdf file with the command :
   renderTask.render();

I see that:
if I don't set the locale with runTask.setLocale(ULocale.ENGLISH)
then the locale come from machine locale for Master Page
if I don't set the locale with renderTask.setLocale(ULocale.ENGLISH)
then the locale come from machine locale for Layout Page

    runTask is defined by IRunTask
and renderTask is defined by IRenderTask
Comment 8 Jun Ouyang CLA 2011-03-02 21:42:23 EST
Localized value should not be saved into report document so that at render time the value can be localized according to render-time locale. This bug is caused by that the content of master page is saved into document after localization. Fix it by saving master page before localization.

Please notice that the final result is localized according to render-time locale. If no locale specified at render-time, it's localized according to default machine locale.
Comment 9 Xiaoying Gu CLA 2011-03-04 02:02:35 EST
Verified with 3.7.0.v20110304-0630