Internationalizing Custom Code

InstallAnywhere 2017

The InstallAnywhere API provides a simple means for localizing custom code actions, panels, and consoles. Here's an example of how to localize a java.awt.Label inside a custom code panel. The custom code panel's setup UI method looks something like this:

public boolean setupUI(CustomCodePanelProxy ccpp)

     {

      Label myLabel = new Label();

      myLabel.setText(ccpp.getValue("MyCustomCodePanel.myLabel"));

}

CustomCodePanelProxy, InstallerProxy, CustomCodeConsoleProxy, and UninstallerProxy provide access to the getValue method. This method takes a string as a parameter that represents the key portion of the key-value pair as defined in InstallAnywhere's international resource files. You can create any name for the key, as long as it does not conflict with previously defined keys. You can even use a pre-existing key to obtain a string that has already been translated in InstallAnywhere's resource files.

However, the prefix _ia. must be added to the beginning of each key. For example, if the custom code used the key MyCode.foo.flotsam, it would need to be added as _ia.MyCode.foo.flotsam. This modification must be repeated for all custom code localized strings and for each supported locale.

Note • To accommodate existing custom code, installers first check for keys starting with _ia. but then make an additional set of passes, this time ignoring the _ia. prefix and searching for the remainder of the key name.

Locale key-value pairs are set directly in the project locales files. They are all named custom_xx where xx is the two-letter locale code for each locale. For instance, the English resource file is custom_en and the Japanese resource file is named custom_ja. These files are in UTF-8 format. For more information of these files, see Localization and Localization Reference.

To create or edit locale keys for every installer project, update the static text. To create or edit keys only in the current project, update the dynamic text. The dynamic text is regenerated every time that you save your project, so update the files every time that the project is changed.

See Also