Add a User Interface Language - SuperWEB2
To add a new user interface language to SuperWEB2, you need to create a resource bundle. This is a set of properties files saved in <tomcat_home>\webapps\webapi\WEB-INF\classes.
For example, the file messages.properties contains values for various strings displayed in SuperWEB2. By default there are several versions of this file with the language code in the filename. These are used for the different languages that are supported out of the box:
You can use the base version (messages.properties) as a template for creating a version for your new language:
- Open messages.properties in a text editor.
Save it as messages_<locale>.properties
Replace <locale> with the relevant 2 character lower case ISO 639 language code (see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for a list of codes).
For example, to add support for French you would save it as messages_fr.properties.
If necessary, you can further specialise your properties files to support regional language variations (such as US and Australian English). See Customise the User Interface Language Based on Country - SuperWEB2 for more details).
Each line in the file contains a property and a value. For example, the following lines define some of the text displayed on the login screen:
CODEpage.login.window.title=Log in page.login.form.heading=SuperWEB2 - Log in
Change the values for each entry in the file to the appropriate translated text (but do not change the names of the properties themselves).
For example:
CODEpage.login.window.title=Ouverture de session page.login.form.heading=SuperWEB2 - Ouverture de session
If your translations contain any non-ASCII characters, you must convert the encoding of these characters to 8-bit printable form. You can do this when you have finished adding all the translations to the file, using a tool supplied with the Java Development Kit. See the section below for further details.
Repeat these steps until you have translated all of the properties files. The following is a list of the main properties files that you need to localise:
Filename | Contains... |
---|---|
CDataOnlineEditRules.properties | Error messages that are displayed when the user attempts to create a table that breaches the configured table rules. |
common_labels.properties | Common labels used through the application. |
database_labels.properties | Database-specific error messages. |
messages.properties | General on screen labels used throughout the application. |
schemaValueSetNodeLabels.properties | Field value set labels used in the drop-down boxes in the field selection tree. The properties in this file by default are for the sample Retail Banking database only. You will need to add additional properties that apply to your databases if you have not already done so. See Configure Field Drop-down Labels - SuperWEB2 for more information about this file. |
There are other properties files in the directory, but they do not contain text displayed to the end user and therefore you do not need to create versions for the new language. If there is no specific properties file for a given language, SuperWEB2 will automatically use the base version of the file instead.
For example, dumpcodes.properties contains a list of fields that are blacklisted from mapping, specified by field ID. It does not contain anything language specific, and therefore does not require a translation. If you do not create a specific version for your language (e.g. dumpcodes_fr.properties) then SuperWEB2 will automatically use the base version (dumpcodes.properties).
In general, it is better not to create additional copies of the properties files unless they are actually required. In the case of dumpcodes.properties, for example, if you create multiple copies of the file and then decide to change the list of blacklisted fields, you would need to apply this configuration change to all the copies of the file. To avoid the potential for misconfiguration, it is better to have a single copy of the file.
When you have finished adding translated versions of all the required properties files, you need to add your new language to the list of supported locales in the faces-config.xml configuration file. See Change the Supported User Interface Languages - SuperWEB2 for more details.
You will need to restart Tomcat or the SuperWEB2 service after making the change to faces-config.xml.
Encoding non-ASCII Characters
If your translated text contains any non-ASCII characters (such as characters with accents and characters from non Roman alphabets), then you must convert these into 8-bit printable form in order to display them in SuperWEB2.
There is a tool supplied with the Java Development Kit called native2ascii that you can use to perform this conversion. See http://mindprod.com/jgloss/native2asciiexe.html for more details. This tool converts each non-ASCII character to a code beginning \u
For example, the session timeout message that displays on the login screen might be translated to French as follows:
page.login.form.invalidSession=Votre session a expiré. S'il vous plaît vous connecter à nouveau.
If this is not encoded in 8-bit printable form, the accented characters will not display properly in SuperWEB2:
Once the file has been converted to ASCII using native2ascii, the translation is represented as follows:
page.login.form.invalidSession=Votre session a expir\u00e9. S'il vous pla\u00eet vous connecter \u00e0 nouveau.
This can now be rendered correctly in SuperWEB2: