BeanConnect permits internationalization and localization of the messages of the BeanConnect resource adapter, the BeanConnect proxy and the BeanConnect Management Console. Internationalization and localization means that the messages that a component passes to the users or writes to log files are output correctly for the relevant environment (country, language).
For this, Java offers classes which provide support for internationalization (such as the class Locale
). To determine the language in which messages are to be output, there are two criteria in BeanConnect:
language (for example en)
region (for example US)
The language code is defined as per ISO-639. The possible values for the region are described in ISO-3166.
By default, BeanConnect supplies messages for the language en and the region US. If the user does not make any explicit selection, the default values apply as specified by the current JVM (Default-Locale
).
BeanConnect provides two methods of changing these default settings:
On starting a Java program, set the locale by defining the following two system properties:
net.fsc.tpbasics.i18n.defaultCountry
andnet.fsc.tpbasics.i18n.defaultLanguage
Store the required settings in the file
beanconnect_i18n.properties
, which must be accessible in the class path of the relevant JVM.
BeanConnect first tries to determine the settings using the system properties. If no system properties have been defined, the system searches for the property file and reads the settings from there. The standard method should be to set the locale in beanconnect_i18n.properties
.
Default configuration
A JAR file (BeanConnectI18N.jar
) is deployed with the installation of the BeanConnect resource adapter, the BeanConnect proxy or the BeanConnect Management Console. This file must be entered in the class path of the JVM. By default, this file has the following contents:
beanconnect_i18n.properties
for setting the localethe message files for the individual components (default language: en, US)
a number of Java classes (Msg...class) which must remain unchanged in the JAR file.
To allow access to the message files, their names must follow a certain pattern.
Several message files with the name <component>.properties
are included. These files act as a fallback and are used if you have given incorrect values for the language and region. The currently used message files are:
Resource adapter |
|
Proxy |
|
Management Console |
|
In addition, a file <component>_en_US.properties
can be contained in the JAR file. This is generally an identical copy of the file <component>.properties
, since en_US
is the default value for BeanConnect message files.
Examples of file names:
proxy.properties
proxy_de.properties
proxy_en_US.properties
proxy_fr_FR.properties
Introducing a new language
You can provide support for other languages by adding message files to the JAR file BeanConnectI18N.jar
. These message files are text files and can be edited with a text editor (such as notepad, vi).
The following example shows the steps necessary for support of German messages.
Extract the default message file (for example
proxy.properties
) from the JAR fileusing the command
jar
or the program WinZip.Translate the messages into German.
Store the new message file with the name
proxy_de_DE.properties
and add it to the JAR file under the same path (net.fsc.tpbasic.i18n.r
) as the default file.Extract the file
beanconnect_i18n.properties
.Enter
de
as the language andDE
as the country:net.fsc.tpbasics.i18n.defaultLanguage=de
net.fsc.tpbasics.i18n.defaultCountry=DE
Write the file
beanconnect_i18n.properties
back to the JAR file.
Apply step 1 to 3 to all the other message files (stub.properties
, ui.properties
, etc.).
When switching to a new language, note that BeanConnectI18N.jar
must be edited for the BeanConnect resource adapter in the file BeanConnect.rar
if the connector is deployed.
For the BeanConnect proxy and the BeanConnect Management Console the
BeanConnectI18N.jar
file must be edited in the BeanConnect home directory <BC_home>/lib
.