The last new parameter is used to set the Locale in the Jasper Report.
When using _nl_BE in Jasper as the Locale we get the correct translated value.
But when using the Jasper Plugin we do not succeed.
What is the exact syntax for Locale?
Maybe there should even be a method that returns this value:
application.getLocale() or i18n.getLocale() or Plugins.jasperPluginRMI.getLocale()
Hi Martin,
For Locale see: JDK 23 Documentation - Home
from this description I see that one has to create a new Locale object:
var myLocale = new java.util.Locale('nl');//using the ISO 3166 language code
then your argument needs the toString method:
var myLocaleString = myLocal.toString();
then use this to pass in to the plugin.
Of course the plugin will do exactly the reverse operation in order to get at the Locale object - but this might be a way to check it works.
I have not tried this but this seems to be the way to test.
Tom
Is there anyone who already has used i18n in combination with the Servoy Jasper Reports Plugin?
I’m using the latest version of the Plugin (2.1.3)
The coding that I use is the following:
var param = new java.util.HashMap();
param.put('sales_invoice_id', '6a27a1a7-c9ce-4bce-9925-ba151df5a20d');
var myLocale = new java.util.Locale('nl', 'BE');//using the ISO 3166 language code
var myLocaleString = myLocale.toString();
var _result = plugins.jasperPluginRMI.jasperReport('havelaar_online', 'webshop_havelaar_invoice.jrxml', null, 'viewer', param, myLocaleString);
return true;
The I18N labels are not shown.
When using I18N within iReports then correct labels are shown.
I tested with both Servoy 3.5.7 and Servoy 4.1, but that doesn’t make any difference as well.
Even with string ‘nl’ or ‘nl_BE’ as last parameter, it is not working.
var _result = plugins.jasperPluginRMI.jasperReport('havelaar_online', 'webshop_havelaar_invoice.jasper', null, 'viewer', param, 'nl_BE');
The i18n-key is shown in the report, not the value (see screenshot)
Of course the i18n-properties file is in the directory where the reports are located (filename is ‘webshop_havelaar_invoice_nl_BE.properties’)
By the way, should we use the .jasper or the .jrxml extension when calling the plugin?