Select Languages - Localization¶
Info
Before continuing, please be sure to read the important help topic "Working with resource strings".
A language in Paquet Builder is a group of resource strings translated into a given language (English, French...). Paquet Builder can create multilanguage packages: that means the package is compiled with several languages and it can display itself in the language selected by the end user at runtime - see below.
For example if the user is French, the package can display its texts in French instead of English (default language), provided that you included the French language in the collection of languages compiled in the package.
This page in Paquet Builder is called the "Language Manager". It lets you maintain the collection of languages you want to compile into the package and actually which languages will be available to end users.
Managing the language collection¶
Languages that are compiled into the package constitute the language collection. You can add/remove/edit languages using the language manager:
-
To add an existing language file to the list, press the Add button and select the language file (.pbr extension).
-
To remove a language, select it and press Remove.
-
To edit the selected language, double-click its icon in the list or press Edit. The resource string editor will be opened to edit this language file.
-
To make the selected language the default one, press the Default button.
The icon indicates the default language that plays an important role (especially in dialogs: see below).
Language names are unique: you cannot have "English" twice for example (but "G.B. English" and "U.S. English" yes).
To write new languages, please refer to the Resource String Editor's help topic.
Warning
Please note that packages must at least contain one language. If you do not want to create multilanguage packages, then just leave one language in the list and set it as the default one.
Creating multilanguage packages¶
Since several languages can be compiled into the package, its user interface may be translated into the end user's own language. When the package is run, end users may be optionally prompted to select their favorite language in the language collection. This is the goal of the following options:
Allow end users to select a language at startup¶
If you enable this option, end users will be asked at startup to select a language from the language collection. The following dialog box will be shown:
End users can select their favorite language in the list (all languages in the collection are listed) and then press OK to continue.
Automatically determine the language to be used¶
If this option is enabled, then the package will try to determine the language that best fits the one of Windows. It asks Windows for the user locale ID (LCID: identifier that is assigned to all languages) and then it compares it with language IDs in its language collection. If one ID corresponds, then the associated language is loaded. Otherwise if none is found, then the default language (see below) is used.
Note
Paquet Builder stores the LCID of the selected language into the variable named %PBLANGID%. You can use this variable to find out which language the end user selected (for instance, for your own application, you can write this value to the registry).
Support for right to left languages¶
By default Paquet Builder uses a left to right layout for dialog boxes. The layout specifies how text and graphics are laid out.
Some languages use right to left reading so the layout has to be right to left, which is the standard in Arabic and Hebrew cultures. For these languages, the "Change window layout to be right to left" option of Paquet Builder should be turned on.
In the Resource String Editor, choose the right to left language in the Edit Language list, click Language Tools and Modify Language Properties. Enable the "Change window layout to be right to left" option and validate with OK.
How to use the first two options?¶
If you enable the first two options, the package will first look for the more appropriate language and loads it if one is found, otherwise the default language will be used. Then it displays the list of available languages for user selection.
The Select Language dialog automatically tries to always display in the user's language when it is available. Otherwise it will display in the default language.
You can also just enable the second option without prompting users for selecting a language: when no appropriate language is found, the package uses the default language.
If you just enable the first option, the package loads the default language and then prompts users for selecting another language if they want.
Set the current language manually¶
Paquet Builder uses LCID (see above) to manage languages. The selected language is defined by the variable named %PBLANGID%
. For instance, if this variable is set to 1036, then the package will display messages in French. You can modify the %PBLANGID% variable with custom actions to change the selected language manually.
Set the language from command-line¶
If you want to define the user language with the package's command line, use the custom action template Set Language From Command Line and import the template into the "Initialization" event.
About the role played by the default language¶
The default language plays an important role because it is loaded when no language corresponding to the user locale is found, and more important: Paquet Builder uses it to determine whether some dialogs should be displayed or not.
The following dialog boxes require special translation: Welcome, Readme, License Agreement and Final screens. As they display rich texts, you have to write a localized rich text for each language you decide to compile into the package.
This is done thanks to the language list : you can select the language in which you would like to edit the corresponding text.
Now you are not forced to write a localized rich text for each language, you can leave the field blank for a given language. In fact, if a text is not available in the language selected by the end user at runtime, the package will then use the one that was written for the default language.
If the text of the default language is left blank, the corresponding screen will be disabled (not shown to users) even if texts for other languages are available! In fact the default language determines which of the dialogs above should be displayed to end users: be sure to first select the language that is considered as the default one.