2004 IR Help Posted August 23, 2006 Share Posted August 23, 2006 By: Thomasvdb1078 - thomasvdb78 Search Multilanguage version of jasper report 2005-08-23 04:57 Hi, I search a multi language version of jasper report. Someboby knows where can I find that? If it's not existing, is it possible to have some information to know how can I translate easily jasper report? Thanks Thomas By: C-Box - c-box RE: Search Multilanguage version of jasper re 2005-08-23 05:03 !?!?!?!? What do you want to do? Translate some fields/lables at runtime? Translate the manual? Translate the whole library from Java to C#? :-) ?!?!?!?!?!? C-Box By: rodica - rodica_balasa RE: Search Multilanguage version of jasper re 2005-10-05 05:54 I have the same problem here, I am translating all the application, and I do not know how tot translate the report! I need to translate only the static text, the report labels. Is there a way to define some keys inside the report definition and to have the translation for each key in external *.properties files? or shoud I modify all reports not to use static text at all, but parameters, and move the translation problem outside the report? By: Lucian Chirita - lucianc RE: Search Multilanguage version of jasper re 2005-10-05 06:14 Hi You can use resource bundles in reports (not with static texts, but text fields). Check the i18n sample. HTH, Lucian By: jane_lim - jane_lim RE: Search Multilanguage version of jasper re 2005-10-05 18:20 Hi, hope this can help ... use text field, dun use static text ... change the text field expression to something like $R{customer.id} go to Edit -> report properties -> i18n -> add ur properties field. the properties file is in same directory with ur jrxml. DONE... there are some samples: http://jasperreports.sourceforge.net/samples/index.html for your application site, you need to add value to parameters, for example ResourceBundle mBundle = ResourceBundle.getBundle("com.resources.MessagesBundle", new Locale("cn", "CN")); parameters.put("REPORT_RESOURCE_BUNDLE", mBundle); parameters.put("REPORT_LOCALE", new Locale("cn", "CN")); By: rodica - rodica_balasa RE: Search Multilanguage version of jasper re 2005-10-06 07:50 So, i add to the report the attribute resourceBundle: <jasperReport name="I18nReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" resourceBundle="i18n"> I send to the report as parameter a Locale and a ResourceBundle parameters.put("REPORT_RESOURCE_BUNDLE", mBundle); parameters.put("REPORT_LOCALE", new Locale("en", "EN")); Inside the report i use only textfields, I have here an example: <textFieldExpression class="java.lang.String"> <![CDATA[ $P{REPORT_LOCALE}.getDisplayName($P{REPORT_LOCALE}) ]]></textFieldExpression> How do i specify for instance to display the key "title"? <textFieldExpression class="java.lang.String"> <![CDATA[ $P{REPORT_RESOURCE_BUNDLE}.getString("title") ]]></textFieldExpression> ? If I have a class for a report, lets say report Invoices is built in my application by Invoices.java, can I have the labes in files: Invoices_en.properties, Invoices_fr.properties ? ResourceBundle mBundle = ResourceBundle.getBundle("com.resources.Invoice", new Locale("en", "EN")); By: Teodor Danciu - teodord RE: Search Multilanguage version of jasper re 2005-10-06 08:04 Hi, What you need to do is explained here: http://jasperreports.sourceforge.net/tutorial/index.html#i18n If you use the "resourceBundle" attribute inside your report template, you don't need to supply the resource bundle using the REPORT_RESOURCE_BUNDLE parameter at fill time. And make sure how you supply the values for the built-in parameters. Don't use the harcoded strings, but rather the constants defined in the JRParameter interface. Inside expressions, the values are retrived based on the key using the $R{key} syntax. I hope this helps. Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now