The following article uses options that are available starting with the Enterprise edition and project type.
To localize the value of a property based on the OS language, the following steps must be taken:
1. Open an existing Advanced Installer project or create a new one and select the default language.
The Project's language is set in the "Start Page" by selecting it in the "Options" -> "Language" field and cannot be changed later.
2. Create the property you want to localize (for example from the Install Parameters Page) and set the value for the default language. For example, if the project's language is English, this value will appear in the English version of the installer.
3. In this example we will use the MY_PROP property with its default value value.
4. 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).
5. Click on the localization button (the one with the flags next to thebutton) in the “Properties” menu of the currently selected property.
6. If there is no localization button, right-click in the field you want to localize and select the “Localization...” item.
7. Make sure that the "Always translate this string" and "Using specified localization identifier" options are selected.
8. Make sure that the localization identifier is set to Property.MY_PROP.
9. Go to the Project Strings Tab from the "Translations" page and click the [ Select... ] button.
10. In the "Localization Options" dialog check the Properties 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.
11. In the same tab click on the [ Create... ] button.
12. Follow the wizard and create a custom dictionary ("example.ail") based on the "English" language.
13. Open the generated dictionary with a text editor (that supports UFT-8 encoding, like Notepad) and find the Property.MY_PROP entry.
14. Set the desired values for lang=fr and lang=de like below:
<ENTRY id="Property.MY_PROP"> <STRING lang="en" value="value"/> <STRING lang="fr" value="valeur"/> <STRING lang="de" value="wert"/> </ENTRY> </DICTIONARY>
- id="Property.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">
15. Save and close the dictionary file.
16. Save the project, close, reopen Advance Installer and load the project.
17. Rebuild and run the project.
You can add more entries in the same dictionary for different values you want to localize. Therefore, it is strongly recommended to follow the above steps and create the dictionary after all the needed properties have been declared.