Skip to main content



      Home
Home » Archived » BIRT » Problems setting the locale manually
Problems setting the locale manually [message #557927] Thu, 09 September 2010 08: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 12:42 Go to previous messageGo to next message
Eclipse UserFriend
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 03: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 11:33 Go to previous message
Eclipse UserFriend
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: Thu Jul 24 10:36:20 EDT 2025

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

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

Back to the top