Jump to content
Changes to the Jaspersoft community edition download ×

i18n, what and when


ktrinad

Recommended Posts

By: Henrik Bentel - hbentel

i18n, what and when

2004-09-21 15:17

hi

 

Just wondered if there is an estimate when(0.6.2?) we can expect i18n support in Jasper? I see on the homepage under future directions that this the next thing listed. The current way of passing in the "static i18n" text in parameters is a bit.... "uncool" :) Anyone know how it is/will be implemented(does it use resourcebundles? are they passed in, or defined in the report)?

 

finally, anything I can do to help to get us there?

 

 

By: Teodor Danciu - teodord

RE: i18n, what and when

2004-09-22 02:34

 

Hi,

 

I take this opportunity to annouce that the next

version will introduce i18n support.

This is already implemented in the CVS version and

there is a little sample called i18n that shows how

it works.

 

Basically, it is about specifying the base name of

a resource bundle liek we do for the scriptlet class.

And then, in the expressions, there is a new tag for

referencing resource in the bundle with $R{my.key}.

 

The viewer was also internationalized.

 

At this stage, feedback is important.

 

Thank you,

Teodor

 

 

 

By: Henrik Bentel - hbentel

RE: i18n, what and when

2004-09-22 09:45

Hi,

 

great news.

 

I took at look at the example in CVS and I have a comment.

It would be good to have support for messageformat also as part of i18n support. For example, I might have in my resourecebundle: "summary.key=There were a total of {0} car parts reported". In a different language it might be: "zxcvzx {0} tsdfg hjkkws"(In my just invented langugage). Java supports even more detailed message templates with parameters like {1,time,short} or {2,number}.

 

I don't really have a good suggestion on how to express this in the reports, other than a new separate element that can contain other nested element, kinda like how JSTL does it (

<fmt:message key="msg.hello"> <fmt:param value=${user.name}"/> </fmt:message>).

 

Another question I have is what is the default behavior when the message key is not found in the resource bundle? does it return an exception or does it return garble("????"). Could this be made configurable, like an attribute "allowNull"?

 

Great work, always waiting for the next version

 

-Henrik

 

 

By: Teodor Danciu - teodord

RE: i18n, what and when

2004-09-25 06:22

 

Hi,

 

This expression should work:

 

java.text.MessageFormat.format($R{summary.key}, new Object[]{$V{MyTotal}})

 

When the message key is missing, no exception

is thrown and null is returned by the $R{} chunk.

 

Thank you,

Teodor

 

 

 

By: Teodor Danciu - teodord

RE: i18n, what and when

2004-09-26 11:05

 

Hi,

 

An utility method was introduced in the calculator

base class to simplify the message formatting.

This method is called "msg" and has several signatures

in order to receive up to 3 positional parameters.

This the above expression could be simplified like this:

 

msg($R{summary.key}, $V{MyTotal})

 

Other utility methods could be introduced in the same

manner, to simplify the expressions.

 

Thank you,

Teodor

 

 

 

By: Henrik Bentel - hbentel

RE: i18n, what and when

2004-09-27 16:43

Very nice.

 

I like the utility method. Makes it look a lot cleaner.

Should meet most needs.

 

And if not we can wait for Java 5 and varargs!

 

Again, Great work

Henrik

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...