Localizing page navigation links in HTML report outputs

When you schedule to publish a report set 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 set.
  3. Apply the localized link names to HTML report outputs.

The following explain the steps in detail:

Creating the property file

To localize the page navigation link names in HTML report outputs, a property file must be create 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.

    For detailed information about the abbreviation for each language and locale, see Appendix 3: Language and Region name list for National Language Support.

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

    C:\j2sdk1.4.2_10\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.

Enabling the language for the report set

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

  1. Start JReport Enterprise Server and log onto the JReport Administration page.
  2. Browse to the row that the report set is in, then click the NLS Editor button in the Control column.
  3. In the NLS Editor dialog, specify a report set and catalog version as required and then click the Add Language button.
  4. In the Add Language dialog, choose the specified language from the Available Languages box and add it to the Selected Languages box. Then click OK.
  5. Click OK in the NLS Editor dialog to confirm the settings.

Now the language will have been enabled for the report set.

Applying the localized link names to HTML report outputs

To apply the localized link names to HTML outputs of the specified report set, follow the steps below:

  1. Log onto the JReport Console page and browse to the report set.
  2. Select the report set row, right-click in the row and then select Advanced Run or Schedule from the shortcut menu.
  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.