Archive: cannot chang language in .onInit


cannot chang language in .onInit
  !insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_RESERVEFILE_LANGDLL

!include "Japanese.nsh"
!include "English.nsh"
LangString MUI_TEXT ${LANG_JAPAN} "${MUI_TEXT_JP}"
LangString MUI_TEXT ${LANG_ENGLISH} "${MUI_TEXT_EN}"

Function .onInit
StrCpy $LANGUAGE ${LANG_JAPAN}
MessageBox MB_OK "$(MUI_TEXT)"
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

..$(MUI_TEXT) cannot chang japanese language


You can use MUI_LANGDLL_WINDOWTITLE and MUI_LANGDLL_INFO to change those strings.


Function .onInit
ReadRegStr $0 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Language"
StrCpy $LANGUAGE $0 ; $0->1041->japan
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(MUI_TEXT)" IDOK uninst
Abort
uninst:
ClearErrors
ExecWait '$R0 _?=$SYSDIR' ;Do not copy the uninstaller to a temp file

IfErrors no_remove_uninstaller ;continue
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
Abort
done:
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

cannot set japan language $(MUI_TEXT) in messagebox


Oh...I understand..see we can't use LangString until the installer UI begins...IMAO.

You can:


nsh

>!include LogicLib.nsh

Name "teta"
>OutFile "teta.exe"
>ShowInstDetails show

>!insertmacro MUI_PAGE_INSTFILES

>!insertmacro MUI_LANGUAGE "Spanish"
>!insertmacro MUI_LANGUAGE "English"

>LangString MUI_TEXT ${LANG_SPANISH} "Hola mundo"
>LangString MUI_TEXT ${LANG_ENGLISH} "Hello world"

>!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
>!insertmacro MUI_RESERVEFILE_LANGDLL

>Function .onInit
>!insertmacro MUI_LANGDLL_DISPLAY
>${if} $LANGUAGE = ${LANG_ENGLISH}
>MessageBox MB_OK "Hello world"
>${else}
>MessageBox MB_OK "Hola mundo"
>${endif}
>FunctionEnd

Section
DetailPrint "$(MUI_TEXT)"
>SectionEnd
>