I made an installer that works with several languages, evrything works fine and when a user runs an installer the language selection screan appears.
But the problem is that if the same user runs the same setup on the same pc again the setup wont ask him to select a language and instead will use a language he selected the first time.
How can I make the installer to ask the user the language each time it runs ?
Installer language
18 posts
You have to delete the corresponding Registry key :-)
You have probably had to use some defines such as (the example is if you use the Modern User Interface plugin):
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY "Software\mysoftwarename"
!define MUI_LANGDLL_REGISTRY_VALUENAME "InstallerLanguage"
Which means the language selected by the user will be saved in the registry in HKLM\Software\mysoftwarename under the key name InstallerLanguage
Don't know though whether you can avoid the language to be saved in the first place by giving an empty registry path or using some other define?
You have probably had to use some defines such as (the example is if you use the Modern User Interface plugin):
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY "Software\mysoftwarename"
!define MUI_LANGDLL_REGISTRY_VALUENAME "InstallerLanguage"
Which means the language selected by the user will be saved in the registry in HKLM\Software\mysoftwarename under the key name InstallerLanguage
Don't know though whether you can avoid the language to be saved in the first place by giving an empty registry path or using some other define?
Or you can use
!define MUI_LANGDLL_ALWAYSSHOW
!define MUI_LANGDLL_ALWAYSSHOW
Excelent !define MUI_LANGDLL_ALWAYSSHOW is exactly what I was looking for.
Thakns.
Thakns.
Hi
This work fine to me too, but when i run unistaller, this not "get" the language ive select when install.
I use this
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_QUESTION) IDYES +2
Abort
FunctionEnd
This work fine to me too, but when i run unistaller, this not "get" the language ive select when install.
I use this
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_QUESTION) IDYES +2
Abort
FunctionEnd
Did you check if the value is recorded in the registry with the MUI_LANGDLL_REGISTRY_ROOT, KEY and VALUENAME you gave?
If it's correct, maybe try with calling the message box after stepping out of function un.onInit?
If it's correct, maybe try with calling the message box after stepping out of function un.onInit?
The MUI_LANGDLL_REGISTRY_ROOT, KEY and VALUENAME are OK
The stranger is that only happens in messagebox of onInit since in the one of onUninstSuccess works fine with the language of the installation
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK $(UN_CONFIRMATION)
FunctionEnd
Any idea?
TIA
The stranger is that only happens in messagebox of onInit since in the one of onUninstSuccess works fine with the language of the installation
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK $(UN_CONFIRMATION)
FunctionEnd
Any idea?
TIA
The language selection doesn't take effect until after .onInit. You can use .onGUIInit to display multilingual messages with ease, or you could use a switch on $LANGUAGE.
Thanks Kichik
And in this part of code how i could use $LANGUAGE??
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_QUESTION) IDYES +2
Abort
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK $(UN_CONFIRMATION)
FunctionEnd
And in this part of code how i could use $LANGUAGE??
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_QUESTION) IDYES +2
Abort
FunctionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK $(UN_CONFIRMATION)
FunctionEnd
If you want to use language strings, use them in un.onGUIInit. If you really must use it in un.onInit, use a switch.
!include LogicLib.nsh
#...
${Switch} $LANGUAGE
${Case} ${LANG_ENGLISH}
MessageBox MB_OK english
${Break}
${Case} ${LANG_FRENCH}
MessageBox MB_OK french
${Break}
${EndSwitch}
Thanks Kichik, but i still vae problems with uninstaller
This is my part of code with your help
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
!include LogicLib.nsh
${Switch} $LANGUAGE
${Case} ${LANG_ENGLISH}
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you wish to uninstall $(^Name) with all componentes?" IDYES +2
Abort
${Break}
${Case} ${LANG_SPANISH}
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "¿Está completamente seguro que desea desinstalar $(^Name) junto con todos sus componentes?" IDYES +2
Abort
${Break}
${Case} ${LANG_PORTUGUESEBR}
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "¿Voce está completamente seguro que desea desinstalar $(^Name) junto con tudos sua componentes?" IDYES +2
Abort
${Break}
${EndSwitch}
FunctionEnd
At this time the messagebox shows ok and in the install language, but the title of the unistall window still in Spanish, but not the title of unistall confirmation.
If you wish ive attach some images.
TIA
This is my part of code with your help
;Uninstaller Functions
Function un.onInit
!insertmacro MUI_UNGETLANGUAGE
!include LogicLib.nsh
${Switch} $LANGUAGE
${Case} ${LANG_ENGLISH}
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you wish to uninstall $(^Name) with all componentes?" IDYES +2
Abort
${Break}
${Case} ${LANG_SPANISH}
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "¿Está completamente seguro que desea desinstalar $(^Name) junto con todos sus componentes?" IDYES +2
Abort
${Break}
${Case} ${LANG_PORTUGUESEBR}
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "¿Voce está completamente seguro que desea desinstalar $(^Name) junto con tudos sua componentes?" IDYES +2
Abort
${Break}
${EndSwitch}
FunctionEnd
At this time the messagebox shows ok and in the install language, but the title of the unistall window still in Spanish, but not the title of unistall confirmation.
If you wish ive attach some images.
TIA
In that case, you can set Caption to a variable and change that variable in that Switch according to the selected language. Or simply put that message box in un.onGUIInit.
Thanks kichik, but if ive try that the compiler says
Error : Function named "un.onGUIInit" already exists.
In other way how can I " set Caption to a variable and change that variable in that Switch according to the selected language", could you help me with some lines in my above code?
TIA
Error : Function named "un.onGUIInit" already exists.
In other way how can I " set Caption to a variable and change that variable in that Switch according to the selected language", could you help me with some lines in my above code?
TIA
You need to tell the MUI you want to use it with MUI_CUSTOMFUNCTION_UNGUIINIT.
Ok and whatsup with
how can I " set Caption to a variable and change that variable in that Switch according to the selected language", could you help me with some lines in my above code?
Thanks a lot
how can I " set Caption to a variable and change that variable in that Switch according to the selected language", could you help me with some lines in my above code?
Thanks a lot
You shouldn't use that. Use un.onGUIInit, it's by far the best solution. But if you insist...
Var caption
Caption $CAPTION
Function un.onInit
# if english...
StrCpy $caption "some caption"
MessageBox MB_OK "some message"
# if hebrew...
StrCpy $caption "koteret"
MessageBox MB_OK "hoda'a"
FunctionEnd
Hi kichik, sorry for insist but just Im beginning with NSIS and are many things that exceed to me, thanks to answer.
Kindly
Kindly
Hello everyone. Kichik is right. This is very interesting. Try this way it works. After adding conditionals that they want wherever they want.
Kichik: you are the master, add this to the Code Example.Name "ChangeCaption"
OutFile "ChangeCaption.exe"
Var CAPTION
Caption $CAPTION
Function .OnInitFunctionEnd
- StrCpy $CAPTION "MyNewCaption"
MessageBox MB_OK "You NOT see the caption here"
Section SectionOneSectionEnd
- MessageBox MB_OK "You NOW see the caption here"