BackPrevious Page Next PageNext

NLS at Report Level

Creating global NLS

Editing local NLS

Editing resource tree NLS

Running NLS reports/dashboards

Localizing page navigation links in HTML report outputs

If the NLS feature is enabled for a report or library component when it is designed in JReport Designer, it will also be available after the report or library component is published to JReport Server. Then when the report or dashboard that contains the library component runs in the client/server scenario, different clients can select different languages to render it.

JReport Server also provides administrators with the NLS Editor in the server console with which they can edit NLS for any report or library component the same as the report designer does in JReport Designer. JReport Server administrators can also create global NLS resources that can be shared by all reports and library components to reduce the translation cost.

Creating global NLS

The global NLS is similar to the local NLS feature. Local NLS is the NLS resource used for a particular report or library component, while global NLS is the NLS resource that can be used for all reports and library components in any catalog in both JReport Server and JReport Designer. With global NLS, you can share the NLS information between all reports and library components and reduce your translation cost. This feature is provided to administrators only.

To create global NLS on JReport Server:

  1. In the JReport Server console, point to Administration on the system toolbar, and then click Language > Global NLS from the drop-down menu to display the Global NLS page.

    Global NLS page

  2. Click the Add button Add button above the Language box. The Select Language Source dialog is then displayed.
  3. Specify where to add the required languages.
  4. Click OK in the Select Language Source dialog. Then,

    The specified languages are now displayed in the Language box in the Global NLS dialog.

  5. Select a language from the Language box to edit global NLS for it.
  6. In the Display tab, click the Add button Add button to add a new row of display.

    Global NLS page - Display tab

    Select the type of the display from the Type drop-down list, which can be one of the following:

    Then specify the key in the Key column and give the corresponding target language text in the Translation column. Click Add button to add more rows and specify the key and translation according to your requirements. To remove a display row, check it and click Delete button.

    If some of the text cannot be displayed when you run the report in the target language, change the font face and font size of the text in the Font tab.

  7. In the Format tab, click the Add button Add button to add a new row of format.

    Global NLS page - Format tab

    In the Key column, specify the format of the key in the original language, then in the Format column, specify the format of the key in the target language. Click Add button to add more rows and specify the format information according to your requirements. To remove a format row, check it and click Delete button.

  8. In the Font tab, click the Add button Add button to add a new row of font.

    Global NLS page - Font tab

    In the Key column, choose from the drop-down lists the font face and font size of the key, in the Font Face column, choose from the drop-down list the font face for the target language, then in the Font Size column, choose from the drop-down list the font size for the target language or check to use relative font size so that the font size can be adjusted according to the font size setting of the web browser. Click Add button to add more rows and specify the font information according to your requirements. To remove a font row, check it and click Delete button.

  9. Repeat the above steps to define global NLS for other languages.
  10. Click OK to accept the settings.

Editing local NLS

JReport allows you to edit NLS for each catalog, report, library component or dashboard as the report designer would with the NLS Editor in JReport Designer. With the NLS Editor, you can translate a catalog, report, library component or dashboard into different languages from the original one. This feature is provided to administrators only.

To edit NLS for a catalog, report, library component or dashboard on JReport Server:

  1. In the Resources page of the server console, browse to the catalog/report/library component/dashboard for which you want to edit NLS, put the mouse pointer over the resource row and click its NLS Editor button NLS Editor button on the floating toolbar. The NLS Editor appears.

    NLS Editor dialog

  2. Specify a report/component/dashboard if you are editing NLS for a report/library component/dashboard and catalog version as required.
  3. Click the Add button Add button above the Language box.
  4. The selected languages are now listed in Language box of the NLS Editor dialog. Select a target language from the box to edit NLS for it.
  5. In the Display tab, click Add button, then in the Add Display dialog, where all the display text in the catalog/report/library component/dashboard are listed, select the keys you want to translate and enter the target language text for the keys in the Translate column, then click OK. The selected keys are now listed in the Display tab of the NLS Editor. You can further edit the translation for the keys here if required. Click Add to Global NLS to add the display information you just specify to the global NLS library of the target language if you want to reuse them later. If some of the keys already exist in the global NLS library, the Add to Global NLS dialog appears for you to handle the duplication.

    If some of the text cannot be displayed when you run the report/library component/dashboard in the target language, change the font face and font size of the text in the Font tab.

  6. Switch to the Format tab, click Add button, then in the Add Format dialog, where all the formats used in objects of the catalog/report/library component/dashboard are listed, select the keys you want to customize and provide the target language format for the keys in the Format column, then click OK. The selected keys are now listed in the Format tab of the NLS Editor. You can further edit the format for the keys here if required. Click Add to Global NLS to add the format information you just specify to the global NLS library of the target language if you want to reuse them later. If some of the keys already exist in the global NLS library, the Add to Global NLS dialog appears for you to handle the duplication.
  7. Click the Font tab, click Add button, then in the Add Font dialog, where all the fonts used in objects of the catalog/report/library component/dashboard are listed, select the keys you want to customize and give the target language font face and font size for the keys in the Font Face and Font Size columns, then click OK. The selected keys are now listed in the Font tab of the NLS Editor. You can further edit the font face and font size for the keys here if required. Click Add to Global NLS to add the font information you just specify to the global NLS library of the target language if you want to reuse them later. If some of the keys already exist in the global NLS library, the Add to Global NLS dialog appears for you to handle the duplication.
  8. Select another language and edit NLS for it as shown above.
  9. Click OK to accept the settings.

Notes:

Editing resource tree NLS

JReport allows you to edit NLS for resources in the resource tree. With resource tree NLS, you can translate the names of all reports, library components and folders in the resource tree into different languages from the original one. This feature is provided to administrators only.

To edit NLS for resources in the resource tree on JReport Server:

  1. In the JReport Server console, point to Administration on the system toolbar, and then click Language > Resource Tree NLS from the drop-down menu to display the Resource Tree NLS page.

    Resource Tree NLS page

  2. Click the Add button Add button above the Language box. The Select Language Source dialog is then displayed.
  3. Specify where to add the required languages.
  4. Click OK in the Select Language Source dialog. Then,

    The specified languages are now displayed in the Language box in the Resource Tree NLS dialog.

  5. Select a language from the Language box to edit resource tree NLS for it.
  6. The resource names are listed in the right panel. Give the corresponding target language text in the Translation column. You can make use of the search text box to search for the Name and Translation items (wildcard search is not supported).
  7. If needed, type the resource name you want to find in the Search box and then click the Search button, which helps you to find the resource quickly.
  8. Click a folder to open resources in it. Give the corresponding target language text in the Translation column.

    When a new page is entered, the modifications you made on the last opened page will be saved automatically.

  9. Repeat the above steps to define resource tree NLS for the other languages as required.
  10. When done, click OK to accept the settings.
  11. Click Export button to export the resource tree NLS map to a resource tree NLS file in the specified location for further use if needed. Only the resource tree of one translated language can be exported at a time and a user can only use the resource tree NLS file exported by himself.

Notes:

Running NLS reports/dashboards

When you have NLS enabled for a report or library component in the JReport Server console, or have an NLS report or library component published to the server from JReport Designer, you can then run the report or dashboard that contains the library component in the specified languages.

Before running a report or dashboard, make sure you have the Execute and/or Edit permissions on it when it's in a public folder in the server resource tree.

To directly run an NLS report/dashboard in a specified language:

  1. In the JReport Server console, point to My Profile on the system toolbar, then click Customize Server Preferences from the drop-down menu.
  2. Select the Advanced tab, check Enable NLS and choose the language from the Default Language drop-down list, in which you want the NLS report/dashboard to display by default, then select the corresponding encoding from the Default Encoding drop-down list.
  3. Click OK to save the changes.
  4. Click Resources on the system toolbar to switch to the Resources page.
  5. Browse to the report/dashboard you want to run and click its name. The report result will then be displayed in the language you have specified.

To run an NLS report in a specified language in Advanced mode:

  1. In the Resources page of the server console, browse to the report you want to run, put the mouse pointer over the report row and click the Advanced Run button Advanced Run button on the floating toolbar.
  2. In the Format tab, select the Enable NLS checkbox, choose the language from the Using Language drop-down list, then select the corresponding encoding from the Encoding drop-down list.
  3. Finish the other related options and click Finish to run the report. The report result will then be run in the selected language.

To schedule an NLS report to make it run in a specified language:

  1. In the Resources page of the server console, browse to the report you want to schedule, put the mouse pointer over the report row and click the Schedule button Schedule button on the floating toolbar.
  2. In the General tab, select the Enable NLS checkbox, then choose the language from the Using Language drop-down list, select the corresponding encoding from the Encoding drop-down list.
  3. Finish the other related options and click Finish to perform the task. The report result will then be run in the selected language.

Localizing page navigation links in HTML report outputs

When you schedule to publish a report to HTML format, or run it in Advanced mode in HTML format, you can localize the names of page navigation links in the HTML report outputs, such as First, Previous, Next, and Last, according to your requirements.

The localizing process is divided into three steps:

  1. Create a property file for the desired language.
  2. Enable the language for the report.
  3. Apply the localized link names to HTML report outputs.

Step 1: Creating the property file

To localize the page navigation link names in HTML report outputs, a property file must be created first for the desired language. To do this:

  1. Create the sub directories in <server_install_root>\resources as follows: <server_install_root>\resources\report\languages\[language-locale]\properties. For example, C:\JReport\Server\resources\report\languages\zh-cn\properties.

    Click here for more information about the naming criterion for language package folders.

  2. Create a report.properties file in the properties directory.
  3. Open the property file and copy the following contents to it:
    # The following is the report properties file format that can localize the link names in HTML.
    4000101=First
    4000102=Prev
    4000103=Next
    4000104=Last
    4000105=Back
    4000106=Refresh
    4000107=@CurrentPageNumber; of @TotalPageNumber;
  4. Translate the text after = to the language specified by the folder name.

    Note: For the line "4000107=@CurrentPageNumber; of @TotalPageNumber;", you just need to translate "of" to the desired language. In the HTML outputs, @CurrentPageNumber will be replaced by the current page number, and @TotalPageNumber by the report total page number.

  5. Save the property file with UTF-8 encoding.
  6. Copy the property file to the <jdk_install_root>\bin directory.

    Note: You can just add the <jdk_install_root>\bin directory to your PATH instead of copying the file.

  7. Convert the contents in the property file into Unicode using native2ascii.exe in <jdk_install_root>\bin by running the following command:

    C:\jdk1.8.0\bin>native2ascii -encoding utf-8 report.properties > newreport.properties

    Note: When you convert your property file to the same directory as the original one, you need to give it a new name instead of replacing the original in order to avoid problems.

  8. Delete report.properties in <server_install_root>\resources\report\languages\[language-locale]\properties and copy newreport.properties in <jdk_install_root>\bin to it, then rename the property file back to report.properties.

Step 2: Enabling the language for the report

When the property file is ready, the next step is to enable the language defined in the file for the required report.

  1. In the Resources page of the JReport Server console, browse to the report and click the NLS Editor button NlS Editor button on the floating toolbar.
  2. In the NLS Editor dialog, specify a report and catalog version as required.
  3. Click the button Add button above the Language box, then in the Add Language dialog, choose the specified language and click OK.
  4. Click OK in the NLS Editor dialog to confirm the settings.

Now the language will have been enabled for the report.

Step 3: Applying the localized link names to HTML report outputs

  1. Log onto the server console, go to the server resource tree in the Resources page and browse to the report.
  2. Put the mouse pointer over the report row and click the Advanced Run button Advanced Run button or Schedule button Schedule button on the floating toolbar.
  3. In the Format/General tab of the Advanced Run/Schedule dialog, check Enable NLS and select the specified language from the Using Language drop-down list.
  4. Specify the other settings and finish the task. Then in the generated HTML outputs, you can see that the page navigation links are displayed in the language you defined for the property file.

BackPrevious Page Next PageNext