BIRT Exchange Forum: language dependent resources - BIRT Exchange Forum

Jump to content


 

BIRT Poll: To best make a table fill a pdf page before breaking (PL=page layout, PBI=page break interval) set:

PL: auto, PBI: 0PL: fixed, PBI: 0PL: auto, PBI: 1000000PL: fixed, PBI: 1000000
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

language dependent resources Rate Topic: -----

#1 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 23 February 2012 - 04:03 AM

Currently we are accessing language dependent resources by specifying a resource file in the "includeResource"-Element:

<simple-property-list name="includeResource">
<value>resources/strings/order_report</value>
</simple-property-list>

So the text keys in resources/strings/order_report.properties are used for the language dependent parts of the report. If I want to change the language, I have the selection either to change the report template (e.g. specifying order_report_de_DE) or to change the resource file so that it contains the wished language resource. But my question is, if there is a possibility to control the resource access via a report parameter, e.g. myLocale, and if so, how the access has to be specified for that.
0

#2 User is offline   JasonW Icon

  • Senior Member
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 2505
  • Joined: 08-August 07


Posted 27 February 2012 - 08:19 PM

Sure. Take a look at this page:
http://wiki.eclipse....g_the_report.3F

Jason
0

#3 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 16 March 2012 - 08:37 AM

View PostJasonW, on 27 February 2012 - 08:19 PM, said:

Sure. Take a look at this page:
http://wiki.eclipse....g_the_report.3F

Jason


None of the methods proposed there worked in my context. I run a RunAndRenderTask from my Java application.
In my rptdesign:
<simple-property-list name="includeResource">
<value>order_report</value>
</simple-property-list>
So I have a order_report.properties for the default locale. Furthermore I have order_report_de_DE.properties, if the locale is de_DE. But however, neither setting the locale from the app nor setting the parameter "__locale" to "de_DE" has any effect. Always order_report.properties is taken.

A further question: java.util.Properties does not support UTF-8, what is very uncomfortable using it for translations into non-latin languages. What alternatives for BIRT?
0

#4 User is offline   JasonW Icon

  • Senior Member
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 2505
  • Joined: 08-August 07


Posted 20 March 2012 - 07:54 AM

If you are using a runandrender task just set the locale on the task.
task.setLocale(new Locale("en", "US"));

Jason
0

#5 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 20 March 2012 - 08:47 AM

Thank you for your reply. But, also this didn't work.
Immediately before running the task, I control the locale with

System.out.println( "task Locale set to: " + task.getLocale().toString());

but only the default properties are taken!

Peter
0

#6 User is offline   JasonW Icon

  • Senior Member
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 2505
  • Joined: 08-August 07


Posted 20 March 2012 - 09:30 AM

Peter,

Are you setting the resource folder in your code? And does the resource folder contain your properties files? Did you set the report to include the generic properties file?

//config is EngineConfig
config.setResourcePath(resourcePath)

Jason
0

#7 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 21 March 2012 - 02:11 AM

Jason,

thank you for your reply. I were very optimistic as I saw that my config resource path was null. So I set it as you told. But the story is always the same! Finally I renamed my default properties into order_report_en_US.properties, but also in this case the locale en_US is taken, independly what locale the task has. (I'm checking this by slightly changing the resource.)

Peter
0

#8 User is offline   JasonW Icon

  • Senior Member
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 2505
  • Joined: 08-August 07


Posted 21 March 2012 - 11:54 AM

Does the resource folder you configured contain all the different locale properties file? Did you add the default properties file to the report design in general resources. Are you setting the keys on text you want to change based on locale?

Jason
0

#9 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 22 March 2012 - 04:26 AM

Jason, my answers in your message ...

View PostJasonW, on 21 March 2012 - 11:54 AM, said:

Does the resource folder you configured contain all the different locale properties file?
-- yes, at the moment these are order_report_en_US.properties and order_report_de_DE.properties, after I have renamed order_report.properties into order_report_en_US.properties.
Did you add the default properties file to the report design in general resources.
-- as I wrote, my design contains:
<simple-property-list name="includeResource">
<value>order_report</value>
</simple-property-list>
at the top level of the <report> element.
Are you setting the keys on text you want to change based on locale?
-- this is proven by changing the _en_US resource. But why this resource is taken, even if task.getLocale() returns de_DE?

Jason


Peter
0

#10 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 22 March 2012 - 05:29 AM

View Postpdo, on 22 March 2012 - 04:26 AM, said:

Jason, my answers in your message ...



Peter



So finally I've found it: In my design there was a line:

<property name="locale">en_US</property>

This seems to have prohibited all other settings!

Peter
0

#11 User is offline   JasonW Icon

  • Senior Member
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 2505
  • Joined: 08-August 07


Posted 23 March 2012 - 11:47 AM

Peter,

Glad to read! By default that property should not be getting set.

Jason
0

#12 User is offline   pdo Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 7
  • Joined: 23-February 12


Posted 26 March 2012 - 12:09 AM

Jason,

the designs I deal with have been typically developed by copying and changing. So I don't know how the locale clause got in.

Another question: Is there an element to say within the design, if there is no resource for the current locale (set by task.setLocale), take the resource from another locale, instead of the default values in the design?

Peter
0

#13 User is offline   JasonW Icon

  • Senior Member
  • Icon
  • View blog
  • Group: Administrators
  • Posts: 2505
  • Joined: 08-August 07


Posted 30 March 2012 - 08:22 AM

Peter,

You could probably do this in script. Just check the return value for a lookup.

Jason
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users