Archive: Modern UI and multilanguage installers


Modern UI and multilanguage installers
  I've recently been trying to create a multilanguage installer using the Modern UI but have run into some issues regarding some of the MUI defined constants.

The following constants,

!define MUI_INNERTEXT_LICENSE_TOP
!define MUI_INNERTEXT_LICENSE_BOTTOM

Are used for defining text on the license screen. Is there anyway to specify text for these constants in different languages within the same file?

Doing the following will not work as I expected,

!define MUI_INNERTEXT_LICENSE_TOP "Hi"
!insertmacro MUI_LANGUAGE "English"

!define MUI_INNERTEXT_LICENSE_TOP "Bonjour"
!insertmacro MUI_LANGUAGE "French"

All you get is errors because makensis sees a multiply defined constant. Is there a way using the LangDLL plugin to find the selected language at runtime and then define the constants that the Modern UI should use based on the selected language?

If the language is known before when the script is being created there are no problems because you only need to have one MUI_LANGUAGE declaration. The issues arise when you want to have a string for each language for the same Modern UI constant.


If you want to change one of the MUI language strings, use !insertmacro instead of !define.

For example:

!insertmacro MUI_LANGUAGEFILE_STRING MUI_INNERTEXT_LICENSE_TOP "Bonjour"
!insertmacro MUI_LANGUAGE "French
This assumes you are using NSIS 2.0b4 with CVS updates.

First, thanks for the reply pengyou.

!insertmacro MUI_LANGUAGEFILE_STRING MUI_INNERTEXT_LICENSE_TOP "Bonjour"

>!insertmacro MUI_LANGUAGE "French
>
The above would seem to work, however when I try to define the same string for a different language it just shows up as blank when I run the installer.

For example,


"Hello"

>!insertmacro MUI_LANGUAGE "English"

>!insertmacro MUI_LANGUAGEFILE_STRING MUI_INNERTEXT_LICENSE_TOP
>"Hello in Japanese"
>!insertmacro MUI_LANGUAGE "Japanese"
In the above case the english string will be loaded but the Japanese will appear as blank text. Any thoughts?

Perhaps the problem is simply that the text string "Hello in Japanese" is not in Japanese?

If you want to see what some "real" Japanese looks like, have a look at the Japanese.nsh file in the "Contrib\Modern UI\Language files" folder under the main NSIS folder.

If you want to test things, try using English and French:

!insertmacro MUI_LANGUAGEFILE_STRING MUI_INNERTEXT_LICENSE_TOP "Hello"
!insertmacro MUI_LANGUAGE "English"

!insertmacro MUI_LANGUAGEFILE_STRING MUI_INNERTEXT_LICENSE_TOP "Hello in French"
!insertmacro MUI_LANGUAGE "French"

You should see both text strings this time.

pengyou, your code is wrong.

The code above:

!define MUI_INNERTEXT_LICENSE_TOP "Hi" 
!insertmacro MUI_LANGUAGE "English"

!define MUI_INNERTEXT_LICENSE_TOP "Bonjour"
!insertmacro MUI_LANGUAGE "French"
Is just fine and works for me. Are you sure you are using the right NSIS version and did not make scripting mistakes?

I still get a blank string, even if I create an installer in French.
I'm using the development snapshot from yesterday (Aug 20th) so I would think everything is up to date. Is it possible the LangDLL plugin could be causing some issues?


Can you attach your script (remove files etc. so it will compile on other system)?


Sure, here is the toned down version of it. I can't even get it to compile as makensis complains of multiply defined symbols.


Joost,

Your code does not work on my system. I am using the latest CVS snapshot (21 August 2003, 19:44 GMT) on Win98SE.

Attached is a modified version of the standard MultiLanguage.nsi script. I have reduced it to three languages and tried adding a !define to customise the MUI_INNERTEXT_LICENSE_TOP string.

When I try to compile this script, it fails:

!define: "MUI_INNERTEXT_LICENSE_TOP"="Hi-English"
!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
!define: "MUI_INNERTEXT_LICENSE_TOP" already defined!
Error in script "C:\Program Files\panic\MultiLanguage.nsi" on line 55 -- aborting creation process
If I change the !define statements to !insertmacro ones, as described in my earlier posting, the script compiles OK.

You have not added a license page to your script. That's why you get errors.


Joost, thanks for the explanation. Some things are so obvious, I have trouble seeing them ;)


Yeh thanks Joost, I definitely missed that one.

Is there anyway to localize MUI_PRODUCT?. If I try to define it for different languages I get a multiply defined symbol error.


Yes, use !undef after inserting the language file.