NLS at Report Level
If the NLS feature is enabled for a report or library component when it is designed in Logi JReport Designer, it will also be available after the report or library component is published to Logi 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.
Logi JReport Server also provides administrators with the NLS Editor in the server console with which they can edit NLS for any catalog, report, library component and dashboard. Besides, Logi JReport Server administrators can create global NLS resources that can be shared and reused when editing NLS in both Logi JReport Server and Logi JReport Designer to reduce the translation cost.
Below is a list of the sections covered in this topic:
- Creating Global NLS
- Editing Local NLS
- Editing Resource Tree NLS
- Running NLS Reports/Dashboards
- Localizing Page Navigation Links in HTML Report Outputs
Creating Global NLS
- In the Logi JReport Server console, point to Administration on the system toolbar, and then select Language > Global NLS from the drop-down menu to display the Global NLS page.
- Select the Add button above the Language box. The Select Language Source dialog is then displayed.
- Specify where to add the required languages.
- Languages Supported by Logi JReport
Adds languages from the languages that Logi JReport supports. - NLS Resource File
Adds languages from an external NLS resource file which has been defined with some language information.NLS resource files should follow the naming rule: NLS_[language]_[region A2]_[User-Defined].properties. The language argument is a valid ISO Language Code as defined by ISO-639. You can find a full list of these codes at a number of sites, for example: http://www.loc.gov/standards/iso639-2/php/code_list.php. The region argument is a valid ISO Country Code as defined by ISO-3166. You can find a full list of these codes at a number of sites, for example: http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html.
- Languages Supported by Logi JReport
- Select OK in the Select Language Source dialog. Then,
- If Languages Supported by Logi JReport is checked in the dialog, the Add Language dialog will be displayed. Select the required languages and select OK to add them.
- If NLS Resource File is checked in the dialog, the File Upload dialog will be displayed. Browse to the local folder where the NLS resource file is located, select the file and then select Open.
The specified languages are now displayed in the Language box in the Global NLS dialog.
- Select a language from the Language box to edit global NLS for it.
- In the Display tab, select the Add button to add a new row of display.
Select the type of the display from the Type drop-down list, which can be one of the following:
- Column
This type is only for page reports running in Page Report Studio. It is the type of display text of columns. - DisplayName
Type of display text of object display name. - Metadata
Type of display text of metadata. Metadata mainly refers to catalog resources, such as table/view columns, business views, formulas, summaries, parameters, and so on. - Label
Type of display text of label, some web controls and UDOs. - Prompt
Type of display text of parameter prompt value. - Title
Type of display text of filter control, library component and objects in it. - TOC
Type of display text in the TOC tree.
Then specify the key in the Key column and give the corresponding target language text in the Translation column. Select to add more rows and specify the key and translation according to your requirements. To remove a display row, check it and select .
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.
- Column
- In the Format tab, select the Add button to add a new row of format.
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. Select to add more rows and specify the format information according to your requirements. To remove a format row, check it and select .
- In the Font tab, select the Add button to add a new row of font.
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. Select to add more rows and specify the font information according to your requirements. To remove a font row, check it and select .
- Repeat the above steps to define global NLS for other languages.
- Select OK to accept the settings.
Editing Local NLS
Using the NLS Editor, administrators can translate a catalog, report, library component or dashboard into different languages from the original one.
- 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 select its NLS Editor button on the floating toolbar. The NLS Editor appears.
- Specify a report/component/dashboard if you are editing NLS for a report/library component/dashboard and catalog version as required.
- Select the Add button above the Language box.
- If you are editing NLS for a catalog, the Select Language Source dialog is displayed. Specify where to add the required languages, then select OK.
- If Languages Supported by Logi JReport is checked in the dialog, the Add Language dialog appears. Select the required languages and select OK to add them.
- If NLS Resource File is checked in the dialog, the File Upload dialog appears. Browse to the local folder where the NLS resource file is located, select the file and then select Open.
- If you are editing NLS for a report, library component or dashboard, the Add Language dialog is displayed. Select the languages in which you want the report/library component/dashboard to display, then selectOK to confirm and go back to the NLS Editor.
- If you are editing NLS for a catalog, the Select Language Source dialog is displayed. Specify where to add the required languages, then select OK.
- 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.
- In the Display tab, select , 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 select 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. Select 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.
- Switch to the Format tab, select , 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 select 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. Select 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.
- Select the Font tab, select , 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 select 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. Select 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.
- Select another language and edit NLS for it as shown above.
- Select OK to accept the settings.
Tip: You can also edit NLS for a specific catalog/report/library component/dashboard version. To do this, in the Logi JReport Server console, access the version table of the resource, then select the NLS Editor link for the resource version.
Notes:
- The keys with default values will not be saved when you select the OK button in the NLS Editor.
- When you switch among different languages by choosing languages from the Language box, you may find that the text in the Translate column become unreadable. To resolve this problem, you can add
-Djreport.url.encoding=UTF-8
to the batch file that starts the server and then restart it. This changes the encoding to Unicode which supports all languages. - The Add to Global NLS option is not available to organization admin.
- You cannot edit NLS for shared reports. A shared report will apply the NLS settings of its original report.
Editing Resource Tree NLS
With resource tree NLS, administrators can translate the names of all reports, library components and folders in the resource tree into different languages from the original one.
- In the Logi JReport Server console, point to Administration on the system toolbar, and then select Language > Resource Tree NLS from the drop-down menu to display the Resource Tree NLS page.
- Select the Add button above the Language box. The Select Language Source dialog is then displayed.
- Specify where to add the required languages.
- Languages Supported by Logi JReport
Adds languages from the languages that Logi JReport supports. - NLS Resource File
Adds languages from an external NLS resource file which has been defined with some language information.NLS resource files should follow the naming rule: NLS_[language]_[region A2]_[User-Defined].properties. The language argument is a valid ISO Language Code as defined by ISO-639. You can find a full list of these codes at a number of sites, for example: http://www.loc.gov/standards/iso639-2/php/code_list.php. The region argument is a valid ISO Country Code as defined by ISO-3166. You can find a full list of these codes at a number of sites, for example: http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html.
- Languages Supported by Logi JReport
- Select OK in the Select Language Source dialog. Then,
- If Languages Supported by Logi JReport is checked in the dialog, the Add Language dialog will be displayed. Select the required languages and select OK to add them.
- If NLS Resource File is checked in the dialog, in the displayed dialog, browse to the local folder where the NLS resource file is located, select the file and then select Open.
The specified languages are now displayed in the Language box in the Resource Tree NLS dialog.
- Select a language from the Language box to edit resource tree NLS for it.
- 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 box to search for the Name and Translation items (wildcard search is not supported).
- Select 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.
- Repeat the above steps to define resource tree NLS for the other languages as required.
- When done, select OK to accept the settings.
- Select 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:
- The resource tree NLS takes effect only when the translated language is the same as the language specified for the option Specify Default Language in the server profile or the browser language, and the former has higher priority.
- Resource tree NLS is not supported for resources from a real path.
Running NLS Reports/Dashboards
When a report or library component is enabled with NLS in the Logi JReport Server console by the administrator, or you have an NLS report or library component published to the server from Logi 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:
- In the Logi JReport Server console, point to My Profile on the system toolbar, then select CustomizeServer Preferences from the drop-down menu.
- 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.
- Select OK to save the changes.
- Select Resources on the system toolbar to switch to the Resources page.
- Browse to the report/dashboard you want to run and select 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:
- 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 select the Advanced Run button on the floating toolbar.
- 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.
- Finish the other related options and select 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:
- 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 select the Schedule button on the floating toolbar.
- 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.
- Finish the other related options and select 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:
- Create a property file for the desired language.
- Enable the language for the report.
- 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:
- 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
.See Naming Criterion for Language Package Foldersfor more information about the naming criterion for language package folders.
- Create a report.properties file in the properties directory.
- 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; - 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.
- Save the property file with UTF-8 encoding.
- 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. - 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.
- 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.
- In the Resources page of the Logi JReport Server console, browse to the report and select the NLS Editor button on the floating toolbar.
- In the NLS Editor dialog, specify a report and catalog version as required.
- Select the button above the Language box, then in the Add Language dialog, choose the specified language and select OK.
- Select 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
- Log onto the server console, go to the server resource tree in the Resources page and browse to the report.
- Put the mouse pointer over the report row and select the Advanced Run button or Schedule button on the floating toolbar.
- 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.
- 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.