Installer language |
您所在的位置:网站首页 › installerlanguage安装 › Installer language |
NSIS DiscussionInstaller language Archive: Installer language is9923rd November 2006 15:50 UTC Installer languageI 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 ? fmt_jsc23rd November 2006 16:43 UTC 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? glory_man23rd November 2006 16:44 UTC Or you can use !define MUI_LANGDLL_ALWAYSSHOW is9923rd November 2006 16:51 UTC Excelent !define MUI_LANGDLL_ALWAYSSHOW is exactly what I was looking for. Thakns. Boyito23rd November 2006 17:00 UTC 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 FunctionsFunction un.onInit!insertmacro MUI_UNGETLANGUAGEMessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_QUESTION) IDYES +2AbortFunctionEnd fmt_jsc23rd November 2006 17:26 UTC 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? Boyito23rd November 2006 17:38 UTC 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.onUninstSuccessHideWindowMessageBox MB_ICONINFORMATION|MB_OK $(UN_CONFIRMATION)FunctionEnd Any idea?TIA kichik23rd November 2006 19:27 UTC 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. Boyito23rd November 2006 19:36 UTC Thanks Kichik And in this part of code how i could use $LANGUAGE?? ;Uninstaller FunctionsFunction un.onInit!insertmacro MUI_UNGETLANGUAGEMessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(UN_QUESTION) IDYES +2AbortFunctionEnd Function un.onUninstSuccessHideWindowMessageBox MB_ICONINFORMATION|MB_OK $(UN_CONFIRMATION)FunctionEnd kichik23rd November 2006 19:39 UTC 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}Boyito 27th November 2006 16:15 UTC 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 kichik 27th November 2006 16:41 UTC 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. Boyito 27th November 2006 16:51 UTC 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 kichik 27th November 2006 16:57 UTC You need to tell the MUI you want to use it with MUI_CUSTOMFUNCTION_UNGUIINIT. Boyito 27th November 2006 17:32 UTC 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 kichik 27th November 2006 17:40 UTC You shouldn't use that. Use un.onGUIInit, it's by far the best solution. But if you insist... Var captionCaption $CAPTIONFunction un.onInit# if english...StrCpy $caption "some caption"MessageBox MB_OK "some message"# if hebrew...StrCpy $caption "koteret"MessageBox MB_OK "hoda'a"FunctionEndBoyito 28th November 2006 12:56 UTC Hi kichik, sorry for insist but just Im beginning with NSIS and are many things that exceed to me, thanks to answer. Kindly UranusOne 20th February 2009 04:43 UTC Hello everyone. Kichik is right. This is very interesting. Try this way it works. After adding conditionals that they want wherever they want. Name "ChangeCaption"OutFile "ChangeCaption.exe"Var CAPTIONCaption $CAPTION Function .OnInit StrCpy $CAPTION "MyNewCaption" MessageBox MB_OK "You NOT see the caption here" FunctionEndSection SectionOne MessageBox MB_OK "You NOW see the caption here" SectionEndKichik: you are the master, add this to the Code Example. Fork me on GitHub |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |