Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Adding data set parameter to localized text?
Adding data set parameter to localized text? [message #495557] Thu, 05 November 2009 11:06 Go to next message
Eclipse UserFriend
Originally posted by: ddd.asd.com

I have defined two resource files: val_en.properties and val_de.properties.
Depending on the machine locale the correct resource will be used.

I have then created a table and bound it to a data set from a xml data
source. Next I have added a text field to the header row.

Now the text field contains a parameter from the data set:

"The space has <VALUE-OF>row["Dimension"]</VALUE-OF> dimensions."

The text needs to be localized (I have localized the text field with a key
from the properties file) but the parameter from the data set does NOT need
to be localized.

Any idea on how to mix localization of text with parameters from a data set?
Re: Adding data set parameter to localized text? [message #495905 is a reply to message #495557] Fri, 06 November 2009 15:12 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try localizing the portion yo need by doing this

<VALUE-OF>reportContext.getMessage("text1");</VALUE-OF>

instead of using the property editor.

Replace text1 with your desired data field.

<VALUE-OF>reportContext.getMessage(row["Dimension"]);</VALUE-OF >

Jason

klm wrote:
> I have defined two resource files: val_en.properties and
> val_de.properties. Depending on the machine locale the correct resource
> will be used.
>
> I have then created a table and bound it to a data set from a xml data
> source. Next I have added a text field to the header row.
>
> Now the text field contains a parameter from the data set:
>
> "The space has <VALUE-OF>row["Dimension"]</VALUE-OF> dimensions."
>
> The text needs to be localized (I have localized the text field with a
> key from the properties file) but the parameter from the data set does
> NOT need to be localized.
>
> Any idea on how to mix localization of text with parameters from a data
> set?
Re: Adding data set parameter to localized text? [message #496263 is a reply to message #495905] Mon, 09 November 2009 14:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ddd.asd.com

"Jason Weathersby" <jasonweathersby@windstream.net> wrote in message
news:hd1eb1$7mt$1@build.eclipse.org...
> Can you try localizing the portion yo need by doing this
>
> <VALUE-OF>reportContext.getMessage("text1");</VALUE-OF>
>
> instead of using the property editor.
>
> Replace text1 with your desired data field.
>
> <VALUE-OF>reportContext.getMessage(row["Dimension"]);</VALUE-OF >
>
> Jason

Ok I think I found something. On this page the last question deals with
above described problem:

http://www.birt-exchange.org/wiki/BIRT:Internationalization/ #Q:_Do_BIRT_reports_support_localization_.28L10N.29_and_inte rnationalization_.28I18N.29.3F


They suggest to use javascript and add the following:

<VALUE-OF>l10nParams = new Array(1); l10nParams[0] = orders;
reportContext.getMessage("messageOrdersKey", reportContext.getLocale(),
l10nParams);</VALUE-OF>

But where should this be added? In a dynamic text box or in the script part
of text box?


And another thing, they write:

" First define the key messageOrdersKey with this content: "There are {0}
orders."

I assume they mean that the this key should be added to the .properties
file, like:

messageOrdersKey = "There are {0} orders."

I have tried this but the text is previewed like this:

There are {0} orders.

I have tried this instead (where part1, and part2 are keys in the property
file):

<VALUE-OF>l10nParams = new Array(1); l10nParams[0] = row["orders"];
reportContext.getMessage("part1", reportContext.getLocale(), l10nParams);
</VALUE-OF>
&nbsp;
<VALUE-OF>
row["WorkingWeeks"];
</VALUE-OF>
&nbsp;
<VALUE-OF>
reportContext.getMessage("part2", reportContext.getLocale());
</VALUE-OF>

Which gives the correct result, but its rather nasty code!
Re: Adding data set parameter to localized text? [message #496332 is a reply to message #496263] Mon, 09 November 2009 17:50 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

If you put the example from the wiki in the properties file and add the
code from the example to a text element with its content type set to
html it should work. The way you got it to work is also fine.

Jason

klm wrote:
>
> "Jason Weathersby" <jasonweathersby@windstream.net> wrote in message
> news:hd1eb1$7mt$1@build.eclipse.org...
>> Can you try localizing the portion yo need by doing this
>>
>> <VALUE-OF>reportContext.getMessage("text1");</VALUE-OF>
>>
>> instead of using the property editor.
>>
>> Replace text1 with your desired data field.
>>
>> <VALUE-OF>reportContext.getMessage(row["Dimension"]);</VALUE-OF >
>>
>> Jason
>
> Ok I think I found something. On this page the last question deals with
> above described problem:
>
> http://www.birt-exchange.org/wiki/BIRT:Internationalization/ #Q:_Do_BIRT_reports_support_localization_.28L10N.29_and_inte rnationalization_.28I18N.29.3F
>
>
>
> They suggest to use javascript and add the following:
>
> <VALUE-OF>l10nParams = new Array(1); l10nParams[0] = orders;
> reportContext.getMessage("messageOrdersKey", reportContext.getLocale(),
> l10nParams);</VALUE-OF>
>
> But where should this be added? In a dynamic text box or in the script
> part of text box?
>
>
> And another thing, they write:
>
> " First define the key messageOrdersKey with this content: "There are
> {0} orders."
>
> I assume they mean that the this key should be added to the .properties
> file, like:
>
> messageOrdersKey = "There are {0} orders."
>
> I have tried this but the text is previewed like this:
>
> There are {0} orders.
>
> I have tried this instead (where part1, and part2 are keys in the
> property file):
>
> <VALUE-OF>l10nParams = new Array(1); l10nParams[0] = row["orders"];
> reportContext.getMessage("part1", reportContext.getLocale(), l10nParams);
> </VALUE-OF>
> &nbsp;
> <VALUE-OF>
> row["WorkingWeeks"];
> </VALUE-OF>
> &nbsp;
> <VALUE-OF>
> reportContext.getMessage("part2", reportContext.getLocale());
> </VALUE-OF>
>
> Which gives the correct result, but its rather nasty code!
>
>
>
Previous Topic:Creation of links dynamically within a text
Next Topic:Tribix emitter on BIRT Viewer
Goto Forum:
  


Current Time: Thu Apr 25 07:53:07 GMT 2024

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

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

Back to the top