- NSIS Discussion
- Modern UI and multilanguage installers
Archive: Modern UI and multilanguage installers
rsegal
21st August 2003 18:11 UTC
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.
pengyou
21st August 2003 21:33 UTC
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.
rsegal
21st August 2003 22:09 UTC
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?
pengyou
21st August 2003 22:26 UTC
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.
Joost Verburg
21st August 2003 22:37 UTC
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?
rsegal
21st August 2003 22:45 UTC
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?
Joost Verburg
21st August 2003 22:50 UTC
Can you attach your script (remove files etc. so it will compile on other system)?
rsegal
21st August 2003 23:08 UTC
Sure, here is the toned down version of it. I can't even get it to compile as makensis complains of multiply defined symbols.
pengyou
21st August 2003 23:23 UTC
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.
Joost Verburg
21st August 2003 23:34 UTC
You have not added a license page to your script. That's why you get errors.
pengyou
22nd August 2003 00:06 UTC
Joost, thanks for the explanation. Some things are so obvious, I have trouble seeing them ;)
rsegal
22nd August 2003 01:04 UTC
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.
Joost Verburg
22nd August 2003 12:09 UTC
Yes, use !undef after inserting the language file.