Skip to content
⌘ NSIS Forum Archive

MUI + Languages + Override default text

9 posts

Misha v.3#

MUI + Languages + Override default text

i try use simple code:

!include "MUI.nsh"
Name "LangTest"
OutFile "LangTest.exe"
LangString WELCOME_TEXT ${LANG_RUSSIAN} "RUSSIAN"
LangString WELCOME_TEXT ${LANG_ENGLISH} "ENGLISH"
 
!define MUI_WELCOMEPAGE_TEXT "$(WELCOME_TEXT)"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Russian"
Section ""
SectionEnd
Function .onInit
    !insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd 
and when i select 'Russian' there are no any text on welcome page.

i try search in forum and find that i must use !insertmacro MUI_LANGUAGE "English" before use ${LANG_RUSSIAN}. but if i move !insertmacro MUI_LANGUAGE "English" on top i get many errors.

also i find information about using
!insertmacro MUI_LANGUAGEFILE_STRING MUI_WELCOMEPAGE_TEXT "..." instead of !define MUI_WELCOMEPAGE_TEXT but in my versions MUI (i try 1.69 and 1.70) this macro is undefied.

i don't want edit languages files and system.nsh because i need override only some string.

where is my mistake?

P.S. i read faq/doc and i try search answers this forum.
P.P.S. changing texts in Sections work fine.
Joost Verburg#
Move:

LangString WELCOME_TEXT ${LANG_RUSSIAN} "RUSSIAN"
LangString WELCOME_TEXT ${LANG_ENGLISH} "ENGLISH"

to the bottom.
Joost Verburg#
Language string names are always unique, the place of the definition doesn't make any difference.

It should be below the language macro in this case because ${LANG_ENGLISH}, the Enlish language ID (1033) is set when the language file is loaded.
Dj Nyx#
i have a little prob...
i tried this first with Misha v.3s code, and it worked...
but i'm not able to get it started in mine

; defines
    !define PRODUCT_NAME "ITS Client"
    !define PRODUCT_VERSION "1.0"
    !define PRODUCT_PUBLISHER "bit media"
    !define PRODUCT_WEB_SITE "http://www.bitmedia.cc"
;--------------------------------
; MUI Settings
    !define MUI_ABORTWARNING
    !define MUI_ICON "${NSISDIR}\Contrib\Graphics\monki-modern_theme\Icon.ico"
    !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\monki-modern_theme\Icon_Un.ico"
    !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\monki-modern_theme\Header.bmp"
    !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\monki-modern_theme\Header_Un.bmp"
    !define MUI_WELCOMEFINISHPAGE_BITMAP  "${NSISDIR}\Contrib\Graphics\monki-modern_theme\Modern_lessorange.bmp"
    !define MUI_UNWELCOMEFINISHPAGE_BITMAP  "${NSISDIR}\Contrib\Graphics\monki-modern_theme\Modern_Un_lessorange.bmp"
    !define LVM_GETITEMCOUNT 0x1004
    !define LVM_GETITEMTEXT 0x102D
;--------------------------------
; include
    ;!include "MUI.nsh"
    !include "${NSISDIR}\Include\MUI.nsh"
    !include "${NSISDIR}\Include\bit_functions.nsh"
    !include "${NSISDIR}\Include\iptest.nsh"
    !include ITSClient.nsh
    
;--------------------------------
; global variables
Var UpdateDir
            # if KindOfInst == 0;       Normal Installation
            # if KindOfInst == 1;       Update
Var KindofInst
Var Ip
;--------------------------------
;initialwerte setzen
    Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
    OutFile "ITSClientSetup.exe"
    InstallDir "$PROGRAMFILES\ITS_Client"
;--------------------------------
;NSIS Schalter setzen
    ShowInstDetails hide
    ShowUnInstDetails hide
;--------------------------------
;Language Selection Dialog Settings
    ;Remember the installer language
    !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" 
    !define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI ITSClient" 
    !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
;--------------------------------
;Installer Functions
Function .onInit
    !insertmacro MUI_LANGDLL_DISPLAY
    !insertmacro wincheck
    !insertmacro checkifupdate
FunctionEnd
;--------------------------------
;welcome page
    !insertmacro MUI_PAGE_WELCOME
    
;--------------------------------
;Languages
    !insertmacro MUI_LANGUAGE "English"
    ;!insertmacro MUI_LANGUAGE "Italian"
    !insertmacro MUI_LANGUAGE "German"
;--------------------------------
;NSIS pages
    !insertmacro MUI_PAGE_LICENSE "License.txt"
    !insertmacro MUI_PAGE_DIRECTORY
    !insertmacro MUI_PAGE_INSTFILES
    !insertmacro MUI_PAGE_FINISH
    !insertmacro MUI_UNPAGE_INSTFILES
Section "Hauptgruppe" SEC01
    DetailPrint "---- Detail ----"
    SetOverwrite ifnewer
    Call IsDotNETInstalled
    Pop $R3
    StrCmp $R3 0 +3
    DetailPrint "Found .NET Framework!"
    Goto +2
    MessageBox MB_OKCANCEL "Can't find .NET, please install!"
    ${If} $KindofInst == 1        
            !insertmacro update
        ${Endif}
        !insertmacro copyfiles
    !insertmacro regdlls
    !insertmacro writesettingsfile
        ${If} $KindofInst == 1
            MessageBox MB_OK "kindofinst 1, settings.xml copied"
            DetailPrint "from: $Updatedir backup\config\settings.xml"
            !insertmacro FileCopy "$Updatedir backup\config\settings.xml" "$INSTDIR\config"
        ${Endif}
    ExecWait '"$INSTDIR\confEdit\confedit.exe" /file:..\config\settings.xml /conf:..\config\config.xml /d a,c'
    Push "$INSTDIR\Logfile_ITSClient.txt"
    Call DumpLog
SectionEnd
;--------------------------------
Section -AdditionalIcons
SectionEnd
;--------------------------------
Section -Post
    WriteUninstaller "$INSTDIR\uninst.exe"
SectionEnd
;--------------------------------
Function .onInstSuccess
    RMDir /r "$Updatedir backup"
FunctionEnd
;--------------------------------
Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) wurde erfolgreich deinstalliert."
FunctionEnd
;--------------------------------
Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Möchten Sie $(^Name) und alle seinen Komponenten deinstallieren?" IDYES +2
  Abort
FunctionEnd
;--------------------------------
Section Uninstall
    RMDir /r "$INSTDIR"
    RMDir /r "$SMPROGRAMS\ITS Client"
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Run\RunCL"
    SetAutoClose true
SectionEnd
;--------------------------------
;Langstrings
LangString WELCOME_TEXT ${LANG_GERMAN} "GERMAN" 
LangString WELCOME_TEXT ${LANG_ITALIAN} "ITALIAN" 
LangString WELCOME_TEXT ${LANG_ENGLISH} "ENGLISH" 
Dj Nyx#edited
no i don't get the box in which i can choose between the languages
Joost Verburg#
There is a probably already a language setting in the registry, you didn't define MUI_LANGDLL_ALWAYSSHOW.
Dj Nyx#
oh i found the problem...
.onInit have to be on the bottom of the document.
at least after the welcome pages, i haven't tried...

but thx for the quickie info