This topic describes National Language Support (NLS) for console extensions within Director.
All IBM Director Console Extensions must be locale-sensitive. This means that if a console in Germany logs into a server in France, the console and all of its extensions will display the German language and use German formatting. Therefore, it does not make sense for data from the agent or the server to contain strings. Values, tokens or ResourceBundle keys are more appropriate. The Console Extension should accept the responsibility for converting the data to locale-specific strings.
The IBM Director product ships in eight languages. IBM Director Console Extensions are expected to provide all language-specific files for each of the eight languages and the default language, which is English. Examples of files that are typically locale-sensitive are Java ResourceBundles, *.rc, *dlg, and so on. Graphics (for example, *.gif or *.bmp files) containing language-specific text (for example, the IBM Director splash screen) must also be provided in each of the eight languages.. The files provided must use the specified code page (see Code Pages used by IBM Director for NLS).
Load all strings visible to users in IBM Director Console Extensions from the ResourceBundle of the appropriate Console Extension. Do not hard-code strings.
Note: Use the country extensions ("_en", "_zh_CN", and so on) exactly as shown in this example. Ensure that all resulting class files are present in the installed product.
ProductResources.java | English default |
ProductResources_de.java | German |
ProductResources_en.java | English |
ProductResources_es.java | Spanish |
ProductResources_fr.java | French |
ProductResources_ja.java | Japanese |
ProductResources_ko.java | Korean |
ProductResources_zh_CN.java | Chinese, simplified |
ProductResources_zh_TW.java | Chinese, traditional |
The code pages are as follows:
Language | Code page |
English | 850 |
French | 850 |
German | 850 |
Spanish | 850 |
Japanese | SJIS |
Korean | 949 |
Chinese, simplified | 1381 |
Chinese, traditional | 950 |
Refrain from programmatically constructing phrases and sentences in a console extension, because the sentence organization will vary by language. If it is necessary to insert a string into a sentence during runtime, include {x} placeholders (x=0,1,2,…) in the sentence in the ResourceBundle of the Console Extension and use the java.text.MessageFormat class to make the placeholder substitutions at runtime. A comment might be placed in the ResourceBundle to tell translators what will be substituted into the sentence for each of the {x} placeholder markers. The translators will translate the sentence and place the placeholder markers correctly. Refer to the string substitution example.
MyResourceBundle is the default ListResourceBundle and contains the following
line:
{ "HelpFilesFoundMsg", "Match found on {0} pages" },
// {0} = number of help pages found
MyResourceBundle_fr is the French ListResourceBundle and contains the
following line:
{ "HelpFilesFoundMsg", " Occurrences trouvées aux pages
{0}" }, // {0} = number of help pages found
The Code that uses MyResourceBundle will contain the following lines:
import
java.text.MessageFormat
int numMatches = getNumberOfHelpFiles();
ListResourceBundle bundle = (ListResourceBundle)ListResourceBundle.getBundle(
"com.ibm.sysmgt.extensiondir.MyResourceBundle",
Locale.getDefault());
String parms[] = new String[1];
parms[0] = Integer.toString(
numMatches );
setStatusText( MessageFormat.format(
bundle.getString("HelpFilesFoundMsg"), parms ));
IBM Director Console assumes responsibility for translating product-specific strings and making them accessible to Console Extensions. This is helpful when the product name is changed because the changes are localized to a small set of files. This minimizes translation costs, frees numbers of developers from being burdened with product name changes and minimizes the probability of the product shipping with an instance of the old product name.
MyResourceBundle is the default ListResourceBundle and contains the following
line:
{ "ConsoleFrameTitle", "{0} Console" }, // {0} =
product name
The Code using MyResourceBundle will contain the following lines:
TWGProductInfo pi =
TWGMainGUI.getProductInfo();
String [] tmpStrArray = new
String[1];
tmpStrArray[0] =
pi.getFullProductName();
setTitle( MessageFormat.format(
bundle.getString( "ConsoleFrameTitle" ), tmpStrArray) );