cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Localizing Custom Code

Localizing Custom Code

Summary

How to localize custom code actions, panels, and consoles.

Synopsis

This article explains how to internationalize custom code actions, panels, and consoles.

Discussion

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. If the _ia. prefix is not used, the key will get removed from the locale file at build time.
  • 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 located under IA_HOME\resource\i18nresources. 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. For more information, see Dynamic and Static Text.
  • NOTE: The _ia. prefix is not required when adding keys to the static text.
  • NOTE: When creating keys in the locale file of the same language the Advanced Designer is running in, those keys will get propagated to the other dynamic locale files and they will be set to a blank value. This means you won't need to manually add each new key to every locale file, but you will need to update the value for each one


As an alternative to the built-in, dynamic locale files, InstallAnywhere allows you to create custom resource bundles. For more information, see External Resource Bundles and Accessing External Resource Bundle in a Custom Code Action.


Additional Information

Customizable Elements of an InstallAnywhere Installer
No ratings
Version history
Last update:
‎Nov 12, 2018 05:58 PM
Updated by: