Multi lingual Jasper - how make it work within iReport ?

150 views
Skip to first unread message

Nicolas Micoud

unread,
May 25, 2015, 5:29:53 AM5/25/15
to idem...@googlegroups.com
Hi,

I'm trying to implement multi lingual jasper reports.
I've followed this link http://wiki.idempiere.org/en/Multi-Lingual_Jasper and i successfully created the new 'Jasper OSGi Test' report and it works perfectly !

Then, i downloaded all files (jrxml, images and properties) and open iReport (ATM, I'm using 4.6.0).
But I can't find a way to make it work within iReport.
I try to change the language in Tools / Options / Compil & Execution but i still got a 'null' instead of 'Título Café' or 'Coffee Title'.

Any idea ?

Thanks,

Nicolas

redhuan d. oon

unread,
May 25, 2015, 7:09:22 AM5/25/15
to idem...@googlegroups.com, nicolas...@gmail.com
You mean the PruebaOSGi.jrxml does not appear as in the wiki page? Btw i am using Jaspersoft Studio.

redhuan d. oon

unread,
May 25, 2015, 7:11:56 AM5/25/15
to idem...@googlegroups.com, red...@gmail.com, nicolas...@gmail.com
Ah yes, you are right, i get null too. I never tested before in the Editor except to modify text and then attach again to test in iDempiere directly.

Nicolas Micoud

unread,
May 25, 2015, 8:12:17 AM5/25/15
to idem...@googlegroups.com
OK, thanks for the answer.
Hope Carlos or anyone else has a solution, because it's not 100% useful.

ATM, I'm handling translation with this kind of expression :

$P{CURRENT_LANG}.equalsIgnoreCase("fr_FR") ? "Page" :
$P
{CURRENT_LANG}.equalsIgnoreCase("it_IT") ? "Pagina" :
$P
{CURRENT_LANG}.equalsIgnoreCase("es_ES") ? "Página" :
null

Nicolas

Hiep Lq

unread,
May 25, 2015, 8:26:18 AM5/25/15
to Mohemmed Bilal Ilyas

Micoud, CURRENT_LANG is pass from idempiere, because always null when run in editor.
2 solution, set a default value for test or use locate parameter
Not sure locate is exact name but you can correct in build in parameters list.

--
You received this message because you are subscribed to the Google Groups "iDempiere" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idempiere+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/idempiere/cf6f887f-223a-43e4-8ded-a21a23b17249%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nicolas Micoud

unread,
May 25, 2015, 8:28:42 AM5/25/15
to idem...@googlegroups.com
Hi Hiep,

my solution (described in previous post) works without problem. I gave it only for information :)
But yes, you're right, it can only works if CURRENT_LANG is not null.

Hiep Lq

unread,
May 25, 2015, 8:44:11 AM5/25/15
to idem...@googlegroups.com
ah. i misunderstand you question.

+ because you is france, please check in your sample has file PruebaOSGi_fr.properties
+ in case you lazy don't want create a new file. set default value for parameter locate = es or en to test effect.
locate is build-in parameter because it's active in idempiere also editor.

Nicolas Micoud

unread,
May 25, 2015, 11:41:44 AM5/25/15
to idem...@googlegroups.com
Still not working but perhaps a tip is in the IRC discussion :

[16:27] <nmicoud> Hi CarlosRuiz ; just in case, any idea for  https://groups.google.com/d/msg/idempiere/Cyk0z4xv4eo/VKuZjkkhS-sJ ?
[16:29] <@CarlosRuiz> hi nmicoud
[16:29] <@CarlosRuiz> does setting the default for the parameter doesn't work?
[16:30] <@CarlosRuiz> BTW - you said 4.6.0?  or maybe is 5.6.0
[16:30] <nmicoud> no, 4.6
[16:30] <@CarlosRuiz> for idempiere it works with 5.6.0
[16:31] <nmicoud> i don't understand. The issue I have is when launching the report within iReport. You mean if i use 5.6, it will be ok ?
[16:32] <@CarlosRuiz> no
[16:32] <@CarlosRuiz> I mean - the version for idempiere 2.1 is 5.6.0
[16:32] <@CarlosRuiz> but I think the solution must be just to set a default for the parameter
[16:32] <@CarlosRuiz> not tested
[16:33] <nmicoud> which parameter ?
[16:33] <nmicoud> RESOURCE ?
[16:33] <@CarlosRuiz> CURRENT_LANG
[16:33] <nmicoud> trying
[16:34] <nmicoud> but there is not such parameter on PruebaOSGI.jrxml
[16:35] <nmicoud> and even if i had on, i still got null (with a value es or es_ES)
[16:40] <@CarlosRuiz> does P_RESOURCE has a default ?
[16:40] <nmicoud> no
[16:41] <nmicoud> and 'Use as a prompt' is not ticked
[16:41] <@CarlosRuiz> don't know where does jasper looks for resource if that's not marked
[16:42] <nmicoud> i though it was in the same directory, but seems not
[16:42] <nmicoud> and i can't find any tutorial
[16:42] <@CarlosRuiz> and if you set P_RESOURCE default?
[16:43] <nmicoud> with 'es' ?
[16:43] <@CarlosRuiz> no - is a folder
[16:43] <@CarlosRuiz> where the resources are
[16:43] <@CarlosRuiz> ending with /
[16:43] <nmicoud> i've put them in the same directory
[16:43] <nmicoud> trying ./ and still returns null
[16:44] <@CarlosRuiz> ... wait ... reading ReportStarter ...
[16:45] <@CarlosRuiz> I see the resources are passed like PropertyResourceBundle
[16:45] <nmicoud> i see
[16:53] <nmicoud> trying http://stackoverflow.com/questions/4684679/program-not-finding-jasperreports-resource-bundle-properties-file
[16:59] <@CarlosRuiz> Nicolas
[16:59] <@CarlosRuiz> there is a property on the report
[17:00] <@CarlosRuiz> called "Resource bundle"
[17:00] <@CarlosRuiz> I set it to "PruebaOSGi" .. maybe it works - can't test because the report has references to Msg that cannot be solved
[17:02] <nmicoud> i see it
[17:02] <nmicoud> setting value to PruebaOSGI and launch
error : Can't find bundle for base name PruebaOSGi, locale es_ES
[17:03] <nmicoud> that should be something like that
[17:40] <nmicoud> I give up... I may not be far from the solution, but still got 'null'. I will copy/paste the discussion on the google group thread and try to do it later

norber...@multimageweb.com

unread,
May 25, 2015, 2:28:16 PM5/25/15
to idem...@googlegroups.com
hi Nicolas

read this topic. would be very nice to go this way.

norbert

This e-mail is confidential and may contain legally privileged information. It is intended only for the addressees and may not be reviewed or used in any way by other recipients. If you have received this e-mail in error, kindly notify us immediately by telephone or e-mail and delete the message and any attachments thereto from your system.

Alejandro Guerra

unread,
May 25, 2015, 5:49:23 PM5/25/15
to idem...@googlegroups.com
hi nicolas, finally Multi lingual Jasper example.... after converted all, i'll share
CustomerStatement.zip

Nicolas Micoud

unread,
May 26, 2015, 3:02:12 AM5/26/15
to idem...@googlegroups.com
Hi Alejandro,

It works, thanks a lot !

To put it in a nutshell, what is necessary ?
 - fill the 'Ressource bundle' property on the report (with a value like 'localization')
 - create properties file localization.properties, localization_es.properties, .... and put them in the same directory
 - replace your label with $R{localization.<my label>}

And that's it !

Nicolas
Reply all
Reply to author
Forward
0 new messages