Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Problems setting the locale manually
Problems setting the locale manually [message #557927] Thu, 09 September 2010 12:46 Go to next message
Eclipse UserFriend
Originally posted by: vm.vm.com

I have an application where I read a .rptdesign file from disk. I then want
to set the locale on the corresponding ReportDesignHandle during runtime to
make sure the right report resources are used (this is not always supposed
to be the current machine locale).

public void init(ReportDesignHandle rpt) {
setLocale(rpt, ULocale.ENGLISH);
saveDesign(rpt);
}

public void setLocale(ReportDesignHandle rpt, ULocale locale) {
try {
rpt.setLocale(locale);
// rpt.setLocale(new ULocale("en_GB"));
// rpt.setLocale(ULocale.ENGLISH);
} catch (SemanticException e) {
logger.error("Locale: " + "not supported", e);
}
}

public void saveDesign(ReportDesignHandle rpt) {
rpt.saveAs("c:\test\test.rptdesign");
}

but when I open the test.rptdesign file it still uses the default
..properties (labels.properties) file instead of the english version
(labels_en_GB.properties).

Is it not possible to update the locale like this during runtime?





Earliere I did:

rpt.setResourceFolder("dir-with-properties-files");
rpt.setIncludeResource("selected-lang-properties-file");

but I hope its possible to avoid this through setting the locale instead...
Re: Problems setting the locale manually [message #557979 is a reply to message #557927] Thu, 09 September 2010 16:42 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try:
rpt.setStringProperty("locale", "de_DE");

You can also set the locale for the task when running the report like:
task.setLocale(new Locale("en", "US"));

Jason

On 9/9/2010 8:46 AM, vm wrote:
> I have an application where I read a .rptdesign file from disk. I then
> want to set the locale on the corresponding ReportDesignHandle during
> runtime to make sure the right report resources are used (this is not
> always supposed to be the current machine locale).
>
> public void init(ReportDesignHandle rpt) {
> setLocale(rpt, ULocale.ENGLISH);
> saveDesign(rpt);
> }
>
> public void setLocale(ReportDesignHandle rpt, ULocale locale) {
> try {
> rpt.setLocale(locale);
> // rpt.setLocale(new ULocale("en_GB"));
> // rpt.setLocale(ULocale.ENGLISH);
> } catch (SemanticException e) {
> logger.error("Locale: " + "not supported", e);
> }
> }
>
> public void saveDesign(ReportDesignHandle rpt) {
> rpt.saveAs("c:\test\test.rptdesign");
> }
>
> but when I open the test.rptdesign file it still uses the default
> ..properties (labels.properties) file instead of the english version
> (labels_en_GB.properties).
>
> Is it not possible to update the locale like this during runtime?
>
>
>
>
>
> Earliere I did:
>
> rpt.setResourceFolder("dir-with-properties-files");
> rpt.setIncludeResource("selected-lang-properties-file");
>
> but I hope its possible to avoid this through setting the locale instead...
Re: Problems setting the locale manually [message #558099 is a reply to message #557979] Fri, 10 September 2010 07:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vm.vm.com

"Jason Weathersby" <jasonweathersby@windstream.net> wrote in message
news:i6b2n1$agd$1@build.eclipse.org...
> Can you try:
> rpt.setStringProperty("locale", "de_DE");


Thanks that works! Out of curiosity why is there a difference between:

rpt.setLocale(ULocale.ENGLISH);
rpt.setStringProperty("locale", "en_GB");

?
Re: Problems setting the locale manually [message #558235 is a reply to message #558099] Fri, 10 September 2010 15:33 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I believe this may be a bug. Any chance you can log it?
Using the setLocale should work.

Jason

On 9/10/2010 3:58 AM, vm wrote:
>
>
> "Jason Weathersby" <jasonweathersby@windstream.net> wrote in message
> news:i6b2n1$agd$1@build.eclipse.org...
>> Can you try:
>> rpt.setStringProperty("locale", "de_DE");
>
>
> Thanks that works! Out of curiosity why is there a difference between:
>
> rpt.setLocale(ULocale.ENGLISH);
> rpt.setStringProperty("locale", "en_GB");
>
> ?
>
>
>
Previous Topic:Joint Dataset
Next Topic:Libraries conflicts on xml apis [websphere-WAS 6]
Goto Forum:
  


Current Time: Fri Apr 19 06:35:53 GMT 2024

Powered by FUDForum. Page generated in 0.03227 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top