Search code examples
installationnsis

NSIS ovverride default translation


In English.nlf I have the following lines

# ^BrowseBtn
B&rowse...

For some particular installation I want to have

# ^BrowseBtn
B&rowse

How can I do this in project.nsi?


Solution

  • LangString "^BrowseBtn" ${LANG_ENGLISH} "B&rowse"
    

    If you are not using the Modern UI and you are not calling LoadLanguageFile "${NSISDIR}\Contrib\Language Files\English.nlf" then LANG_ENGLISH will not be defined, just use 1033 for english.

    If you just want to replace the text on a specific page but leave BrowseBtn as the default, you could change the text in the show callback for the page:

    !include WinMessages.nsh
    
    Function MyDirShow
    FindWindow $0 "#32770" "" $HWNDPARENT
    GetDlgItem $0 $0 0x3E9 ; Id of Browse button on the dir page
    SendMessage $0 ${WM_SETTEXT} 0 "STR:B&rowse"
    FunctionEnd
    
    Page Directory "" MyDirShow