## NLS at application level

In JReport Enterprise Server, a folder "resources" is added in the installation root directory for holding language packages. Each language package contains all the UI text and messages available in JReport Enterprise Server and JReport Web and specifies the UI text in a specific language. When a language package is applied, the JReport Enterprise Server and JReport Web UI will be displayed in the language specified in the language package. When there are more than one language packages, you can select the one you are familiar with for your own convenience as the JReport Enterprise Server environment language. For example, if you are a German you may be glad to apply the German language package.

Moreover, when creating a WAR/EAR file to include a JReport Enterprise Server, the languages.jar which packs all language resources in the `<server_install_root>\resources` directory will be generated and included for the multiple language support. The languages.jar makes sure the server UI text is displayed correctly after deploying the WAR/EAR to other application servers.

### Manually adding a language package

Currently JReport provides only the English language packages: en and en-us. However, JReport accepts user-customized language packages and can recognize and load them if they are correctly specified, though it may be a big task.

In each language package, there are three property files which together contain all UI text and messages in JReport Enterprise Server and JReport Web:

- common.properties
  This property file stores UI text and messages referred by both JReport Enterprise Server and JReport Web in the specific language.
- dhtml.properties
  This property file stores UI text and messages referred by JReport Web in the specific language.
- server.properties
  This property file stores UI text and messages referred by JReport Enterprise Server in the specific language.

The structure of a language package which is stored in the `<server_install_root>\resources\server\languages` directory follows:

\LanguageName

\properties
common.properties
dhtml.properties
server.properties

To add a language package, follow the steps below:

1. Browse to the `<server_install_root>\resources\server\languages` directory.
2. Create a folder named fr. The folder name should keep to the naming criterion.
3. Copy the properties folder in the existing `<server_install_root>\resources\server\languages\en` directory to the \fr folder.
4. Modify the three property files: common.properties, dhtml.properties, and server.properties in the \fr folder. Translate all the text and messages after "=" in these files to French.
5. Save these property files with UTF-8 encoding.
6. Convert the contents in the three property files into Unicode using native2ascii.exe in the `<jdk_install_root>\bin` directory by running the following line in the Command Console:

   `C:\j2sdk1.4.2_04\bin>native2ascii -encoding utf-8 common.properties >newcommon.properties`

   `C:\j2sdk1.4.2_04\bin>native2ascii -encoding utf-8 dhtml.properties >newdhtml.properties`

   `C:\j2sdk1.4.2_04\bin>native2ascii -encoding utf-8 server.properties >newserver.properties`

   Note: When you convert your property files to the same directory as the original ones you need give them new names instead of replacing the original in order to avoid problems.

7. Delete the original property files.
8. Change the names of the generated property files back to the same names as the original property files: newcommon.properties to common.properties, newdhtml.properties to dhtml.properties, and newserver.properties to server.properties.
9. Restart JReport Enterprise Server.

Naming criterion for language package folders

* FolderName(language)

* FolderName(language-country)

* FolderName(language-country-variant)

The folder name should be lower-case codes.

The language argument is a valid ISO Language Code. These codes are the lower-case two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, for example: http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt.

The country argument is a valid ISO Country Code. These codes are the lower-case two-letter codes 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.

The variant argument is a vendor or browser-specific code. For example, use win for Windows, mac for Macintosh, and posix for POSIX. Where there are two variants, separate them with an underscore, and put the more important one first.

### Specifying the application language

Once the application language is set, it takes effect in both JReport Enterprise Server and JReport Web. There are two ways of setting the application language:

- Specifying by UI option

  There is an option Specify Default Language for you to switch the application language. The available language list depends on the language packages in `<server_install_root>\resources\server\languages`.

  To specify the application language:

  - For administrators, on the JReport Administration page, click Profile on the system toolbar, then click Customize Server Preferences on the task bar of the Profile page, select the Advanced tab and set the default application language for all users.
  - For end users, on the JReport Console page, click Profile on the system toolbar, then click Customize Server Preferences on the task bar of the Profile page, select the Advanced tab and set an application language for themselves.
- Specifying by URL parameter

  End users can control the application language by the parameter jrs.language when accessing the JReport Console page or JReport Web UI via URLs. The format of the URL is as follows:

  `http://IP_Address:port/context/pagename?parameter=value&jrs.language=Language_Name`

  The value of jrs.language should be the same as the language package folder name in the `<server_install_root>\resources\server\languages` directory and be lower-case letters.

  The following are two examples:

  - URL for accessing the JReport Console page:

    `http://127.0.0.1:8888/jinfonet/index.jsp?jrs.language=zh-cn`

  - URL for opening a report set in the DHTML format in JReport Web UI:

    `http://127.0.0.1:8888/dhtmljsp/dhtml.jsp?jrs.cmd=jrs.try_vw&jrs.report=/SampleReports/EmployeeInformation.cls
    &jrs.catalog=/SampleReports/SampleReports.cat&jrs.cat_version=1&jrs.path=/SampleReports/EmployeeInformation.cls
    &jrs.result_type=8&jrs.language=zh-cn`

Note: The specified application language by URL parameter has higher priority than that specified by UI option, and however takes effect only in the current user session.