How to localize the project specific UI dialogs of an MSI package?
The following article uses options that are available starting with the Enterprise edition and project type.
To localize the dialogs of an MSI installer package based on the OS language, the following steps must be taken:
1. Create a new Advanced Installer project and set the value for the default language. For example, English.
The Project's language is set in the "Start Page" by selecting it in the "Options" -> "Language" field and cannot be changed later.
2. Add, create or edit the MSI dialogs that will appear during the installation.
3. Go to the "Translations" page in the "Languages tab" and select the languages "English", "French" and "German" (this is just an example, you can select any languages you want).
4. Go to "Project Strings tab" under the "Translations" section, click on thebutton and choose the "User Interface" option.
There are two ways of translating project strings to a custom dictionary and including it into your project. One involves using Advanced Installer's predefined dictionary editor from the Project Strings Tab -> "Project Strings" section. The other involves manually editing the dictionary file and is described in this article.
5. Under the "Translations" section of the same tab click on thebutton. The Create Project Dictionary Wizard will appear. From its list select the language that will serve as a source for translation. For example, English.
6. Click on thebutton to specify the path where the dictionary will be created and saved.
The created dictionary will contain all the localization identifiers which don't have a translation in the Advanced Installer built-in dictionaries. For those properties that have translations in the built-in dictionaries of Advanced Installer, it is possible to change these localization values by simply declaring the identifier with its values in the newly created dictionary based on the following example.
7. Select the desired UI element to be localized from the MSI dialog. In the "Properties" panel click on the "Text" field under the "Display" section. This field will contain the value for the default language, in this case English.
8. Click on the localization button (the one with the flags next to thebutton) of the currently selected property.
9. If there is no localization button, right-click in the field you want to localize and select the "Localization..." menu.
10. If the options "Always translate this string" and "Using specified localization identifier" are not selected, enable them.
11. The text box contains the identifier based on which this property is localized. Remember this identifier. In this example, we will address to it as Control.Text.NewDialog#MY_PROP. Open the generated dictionary with a text editor (that supports UFT-8 encoding, like Notepad) and find the Control.Text.NewDialog#MY_PROP entry.
12. Set the desired values for lang=fr and lang=de like below:
<ENTRY id="Control.Text.NewDialog#MY_PROP"> <STRING lang="en" value="value"/> <STRING lang="fr" value="valeur"/> <STRING lang="de" value="wert"/> </ENTRY>
- id="Control.Text.NewDialog#MY_PROP" - is the identifier used to localize the property's value.
- lang="eng" value="value" - is the value for English language. This is for reference only.
- lang="fr" value="valeur" - is the value for French language.
- lang="de" value="wert" - is the value for German language.
The property's value for the English language (project's language) will be the one set in the project and not the one from the dictionary, because as you can see in the dictionary file on the second row, the English translation from the file is ignored: <DICTIONARY type="multi-language" ignore="en">
13. Save and close the dictionary file.
14. Save the project, close, reopen Advance Installer and load the project.
15. Rebuild the project and run it.