iReport Ultimate Guide - Nimsoft Library
iReport Ultimate Guide - Nimsoft Library iReport Ultimate Guide - Nimsoft Library
iReport Ultimate GuideFigure 17-4The resource bundle in the Favorites viewThe bundle node in Favorites provides several tool features. Right-click the file node to open one of the editing tools for theresource bundle:• Edit. Opens a resource bundle as a text file (see Figure 17-3)• Open. Opens the visual resource bundle editor that shows at the same time the translations for all the language you aresupporting (see Figure 17-5).Figure 17-5Visual Bundle EditorTo add a new locale (meaning support for a new language), right-click the resource bundle node and select the menu item Addlocale.... This will pop up the window shown in Figure 17-6. It is used to set the correct language specifications (language,country and optionally a variant code).326
InternationalizationFigure 17-6New localeBy confirming the choice, a new file will be created in the same directory as the default one; it will have the proper localizationabbreviation appended to the file name, and it will be visible as a child of the bundle node in the Favorites view.17.2 Retrieving Localized StringsThere are two ways to retrieve the localized string for a particular key inside a JasperReports expression:• Use the built-in str("key name") function• Use the special syntax $R{key name}Here is an example expression for retrieving a localized string:$R{hello.world}UR converts the text associated with the key hello.world using the most appropriate available translation for theselected locale.17.3 Formatting MessagesThe internationalization features included with UR are based on the support provided by Java. One of the mostuseful features is the msg function, which you can use to dynamically build messages using arguments. In fact, msg usesstrings as patterns. These patterns define where arguments, passed as parameters to the msg function, must be placed. Theposition of an argument is expressed using numbers between braces, as in this example:“The report contains {0} records.”The zero specifies where to place the value of the first argument passed to the msg function. The expression:msg($R{text.message}, $P{number})uses the string referred to by the key text.message as the pattern for the call to msg. The second parameter is the firstargument to be replaced in the pattern string. If text.message is the string “The report contains {0} records.” andthe value for the report parameter number is 100, UR displays the interpreted text string as:The report contains 100 records.327
- Page 275 and 276: Flash ChartsFigure 13-49 Specifying
- Page 277 and 278: Lists, Tables, and BarcodesCHAPTER
- Page 279 and 280: Lists, Tables, and BarcodesFor your
- Page 281 and 282: Lists, Tables, and Barcodesidentifi
- Page 283 and 284: Lists, Tables, and BarcodesList ele
- Page 285 and 286: 14.2 TablesLists, Tables, and Barco
- Page 287 and 288: Lists, Tables, and BarcodesiReport
- Page 289 and 290: Lists, Tables, and BarcodesFigure 1
- Page 291 and 292: Lists, Tables, and BarcodesSimilarl
- Page 293 and 294: Lists, Tables, and BarcodesFigure 1
- Page 295 and 296: Lists, Tables, and BarcodesFigure 1
- Page 297 and 298: Lists, Tables, and BarcodesWhen usi
- Page 299 and 300: SubdatasetsCHAPTER 15 SUBDATASETSRe
- Page 301 and 302: SubdatasetsUR permits you to use a
- Page 303 and 304: SubdatasetsFigure 15-7Initial layou
- Page 305 and 306: SubdatasetsFigure 15-11 Pie dataset
- Page 307 and 308: CrosstabsCHAPTER 16 CROSSTABSA cros
- Page 309 and 310: CrosstabsUsing the Crosstab Wizard,
- Page 311 and 312: CrosstabsFigure 16-6Outline tree vi
- Page 313 and 314: CrosstabsFigure 16-8Adding a Row Gr
- Page 315 and 316: CrosstabsFigure 16-11 Empty row tot
- Page 317 and 318: CrosstabsFigure 16-16 Crosstab Prop
- Page 319 and 320: CrosstabsFigure 16-19 Crosstab Data
- Page 321 and 322: CrosstabsFigure 16-22 The result of
- Page 323 and 324: InternationalizationCHAPTER 17 INTE
- Page 325: InternationalizationFigure 17-2Crea
- Page 329 and 330: InternationalizationFigure 17-7Loca
- Page 331 and 332: ScriptletsCHAPTER 18 SCRIPTLETSA sc
- Page 333 and 334: ScriptletsTable 18-1Report eventsEv
- Page 335 and 336: ScriptletsFigure 18-3Adding a Jar t
- Page 337 and 338: ScriptletsFigure 18-5Build output18
- Page 339 and 340: ScriptletsIf you want to add more s
- Page 341 and 342: ScriptletsThis is what you get in t
- Page 343 and 344: Scriptletsterminates the report exe
- Page 345 and 346: Additional ToolsCHAPTER 19 ADDITION
- Page 347 and 348: Additional ToolsFigure 19-3Date and
- Page 349 and 350: Additional ToolsFigure 19-4Percenta
- Page 351 and 352: 19.5 How to Run the SamplesAddition
- Page 353 and 354: Chart Theme ExampleAPPENDIX ACHART
- Page 355 and 356: Chart Theme ExampleCode Example A-1
- Page 357 and 358: IndexINDEXAAdd selected field(s) 20
- Page 359 and 360: Indexcomponents 241embedded in Java
- Page 361 and 362: Indexscriptlets 53sheets. See prope
<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong>Figure 17-4The resource bundle in the Favorites viewThe bundle node in Favorites provides several tool features. Right-click the file node to open one of the editing tools for theresource bundle:• Edit. Opens a resource bundle as a text file (see Figure 17-3)• Open. Opens the visual resource bundle editor that shows at the same time the translations for all the language you aresupporting (see Figure 17-5).Figure 17-5Visual Bundle EditorTo add a new locale (meaning support for a new language), right-click the resource bundle node and select the menu item Addlocale.... This will pop up the window shown in Figure 17-6. It is used to set the correct language specifications (language,country and optionally a variant code).326