inigobar
1st July 2009 10:08 UTC
Custom Page Multi- Language
Hi All.
I want to add some custom pages during the installation of my application. I know how to set different languages for pages like Welcome, InstFiles, Finish,etc, by adding LangDLL::LangDialog to .onInit funtion.
My question is: How can I change the text of some controls defined in som .ini files ?
For example, I have the Following code in an .ini file.
; Ini file generated by the HM NIS Edit IO designer.
****************
[Settings]
NumFields=1
[Field 1]
Type=RadioButton
Text=MyText
Left=121
Right=196
Top=22
Bottom=32
State=1
****************
I Load and show it by using:
ReserveFile "MyIniFile.ini"
!insertmacro INSTALLOPTIONS_EXTRACT "MyIniFile.ini"
!insertmacro INSTALLOPTIONS_DISPLAY "MyIniFile.ini"
!insertmacro INSTALLOPTIONS_READ $MyVariable "MyIniFile.ini" "Field 1" "State"
How can I do to automatically change the text MyText of the Custom page depending on the selected Language? I think i need to add lines with the translation like:
LangString MyTest${LANG_ENGLISH} "blablabalbalba"
but I dont know how to add this variable to the .ini file.
Thanks in advance! :)
Afrow UK
1st July 2009 23:29 UTC
You have to write it using INSTALLOPTIONS_WRITE/WriteINIStr.
Stu
inigobar
1st July 2009 23:40 UTC
Hi!
Thanks for your reply. I'm going to do some test. Do you know where can I find an small example of this?
Thanks in advance! :)
inigobar
2nd July 2009 10:21 UTC
I've solved the problem. I post an example here:
****** INI FILE********
[Settings]
NumFields=1
[Field 1]
Type=Label
Text=Any Text
Left=29
Right=143
Top=17
Bottom=25
****************
**********NSIS Script*********
Page custom CustomPageFunction
Function CustomPageFunction
ReserveFile "MyIniFile.ini"
!insertmacro INSTALLOPTIONS_EXTRACT "MyIniFile.ini"
;Translate Dialog Texts
!insertmacro INSTALLOPTIONS_WRITE "MyIniFile.ini" "Field 1" "Text" "$(MyText)"
!insertmacro INSTALLOPTIONS_DISPLAY "MyIniFile.ini"
!insertmacro INSTALLOPTIONS_READ $MyVariable"MyIniFile.ini" "Field 1" "State"
FunctionEnd
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
;Definition of the text string in different languages
LangString MyText ${LANG_ENGLISH} "Text In English"
LangString MyText ${LANG_FRENCH} "Text in French"
*********************************
MUI_LANGUAGE and LangString function MUST be after any Page either custom or non-custom such as MUI_PAGE_DIRECTORY or MUI_PAGE_WELCOME.
Hope it helps :)
sprinleo
22nd September 2009 10:28 UTC
hi,
does anybody know how to display a EULA in a custom license page using InstallOptions ?
i have already prepared the .ini file for the same and managed to display it. need to know the trick to display the EULA inside the text box. clues ?
thanks in advance ....