Download User manual

Transcript
Internationalization
in the classpath for a file that has as a name the Resource Bundle Base Name plus
the “.properties” extension (so in the previous example it will look for a file named
exactly i18nReport.properties). If this file is found, it will be the default resource
from which is read the localized text.. The resource bundle base name has to be
specified in the “i18n” tab in the report properties window (see page 40).
When it is required to print using a specific locale, JasperReports looks for a file
starting with the resource bundle base name string, followed by the relative
language and country code relative to the requested Locale. For example,
i18nReport_it_IT.properties is a file that contains all locale strings to print in
Italian, by contrast i18nReport_en_US.properties contains the translations in
American English. So it’s important to always create a default resource file that will
contain all the strings in the most widely used language and a set of language
specific files for the other languages.
The default resource file does not have a language/country code after the Resource
Bundle Base Name and the contained values are used only if there is no resource
file that matches the requested Locale or if the key of a translated string is not
present in that file.
The complete resource file name is composed as follows:
<resource bundle base name>[_language code[_country code[_other code]]]
Here are some examples of valid resource file names:
i18nReport_fr_CA_UNIX
i18nReport_fr_CA
i18nReport_fr
i18nReport_en_US
i18nReport_en
i18nReport
The “other code” (or alternative code), that is the rightmost one after the language
and the country code ( “_UNIX” in the above example) is commonly never used for
reports, but it is a way to identify very specific resource files.
iReport has the ability to manage resource files for report localization by itself. The
only conditions are that the resource files be located in the same directory where the
jrxml source file is located, and that the resource bundle base name is equal to the
jrxml source file name (extension excluded).
To access the list of available resource files for a report, select the menu “View →
Internationalization” and then “Localization files”.
Figure 11.1 Window to manage resource files
125