Skip to content
⌘ NSIS Forum Archive

InstallOptions and multi-language support?

5 posts

Guest#

InstallOptions and multi-language support?

Hello,

can anybody tell me how to create a custom page with InstallOptions and multi-language support?
Example - I created an ini-File with a field like this:

[Field 1]
Type=label
Text=Summary:
Left=0
Right=-1
Top=0
Bottom=10

How can I change the value for Text depending on the chosen installation language? I guess there is a simple answer, but I haven't found it yet. Any help would be appreciated.
prodigy7#
Hi Jim,

i'd the same problem (multilanguage + installoption) and found only the solution, make for every language one file.

I found the following way, works good for me and doesn't make more work (lines) in my setup script:

First i define all language ini's:

Example:
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "OptionsABC-1031.ini" "OptionsABC-1031"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "OptionsABC-1033.ini" "OptionsABC-1033" 
1031 is the value for german, 1033 for english.

In the second step, i do follwing:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "OptionsABC-$LANGUAGE" 
The variable $LANGUAGE contains the current language code (if the user select for example german, the code is 1031).

I hope, this solution helps you.

p7
onad#
Well once again, look in the Moreinfo plugin example 😉



a customepage multilanguage example there... you do not even need the plugin for using this technique, very extensible and maintainable.
goldy1064#
Or you can do what I do. Have a file with all your LangStrings and call a function after you extract the ini file and before you call initdialog and do:


LangString localizedString ${LANG_ENGLISH} "bla"
LangString localizedString ${LANG_JAPANESE} "japanese bla"

Function SetIniFile
WriteRegStr "$PLUGINSDIR\file.ini" "Field 1" "Text" "$(localizedString)"
FunctionEnd
This gets rid of having to use seperate INI files.
Guest#
Originally posted by onad
[B]Well once again, look in the Moreinfo plugin example 😉
Excellent! Just what I've been looking for. This should be put into the FAQ or even the NSIS documentation. I guess lots of people will need this info.
Thanks!!
PS goldy1064, your solution is also quite good, but onad's is more easily maintainable in the long run, I guess.