Problems setting the locale manually [message #557927] |
Thu, 09 September 2010 12:46 |
Eclipse User |
|
|
|
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 |
|
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...
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03227 seconds