Answer
To localize the value of a property based on the OS language, the following steps must be taken:
- 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.
- Create the property you want to localize 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.
- In this example we will use the MY_PROP property with it's default value value.
- Go to the Translations page and select the languages "English", "French" and "German" (this is just an example, you can select any languages you want).
- Click on the localization button (the one with the flags next to the button) in the “Properties” menu of the currently selected property.
- If there is no localization button, right-click in the field you want to localize and select the “Localization...” item.
- Make sure that the "Always translate this string" and "Using specified localization identifier" options are selected.
- Make sure that the localization identifier is set to Property.MY_PROP.
- Go to the Languages tab of the "Translations" page and click the [ Select... ] button.
- In the "Localization Options" dialog check the Properties option.
- In the "Languages" tab click on the [ Create... ] button.
- Follow the wizard and create a custom dictionary ("example.ail") based on the "English" language.
- Open the generated dictionary with a text editor (that supports UFT-8 encoding, like Notepad) and find the Property.MY_PROP entry.
- 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>Where:
- 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">
- Save and close the dictionary file.
- Save the project, close, reopen Advance Installer and load the project.
- Rebuild and run the project.
You can add more entries in the same dictionary for different values
you want to localize. Therefor, it is strongly recommended to follow the
above steps and create the dictionary after all the needed
properties have been declared.