OutFile "AutoLanguage.exe" LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" Name "AutoLanguage English" LoadLanguageFile "${NSISDIR}\Contrib\Language files\Spanish.nlf" Name "AutoLanguage Spanish" LoadLanguageFile "${NSISDIR}\Contrib\Language files\Portuguese.nlf" Name "AutoLanguage Portuguese" LoadLanguageFile "${NSISDIR}\Contrib\Language files\PortugueseBr.nlf" Name "AutoLanguage Portuguese (Brasil)" ;Compare two langs in neutral mode. ; ;!!! WARNING! Modifies $R0 !!! ; !macro COMPARE_NEUTRAL_LANGIDS LANG1 LANG2 JUMP1 JUMP2 Push $R1 StrCpy $R0 ${LANG1} StrCpy $R1 ${LANG2} IntOp $R0 $R0 & "1023" IntOp $R1 $R1 & "1023" StrCmp $R0 $R1 0 +3 StrCpy $R0 "1" Goto +2 StrCpy $R0 "0" Pop $R1 StrCmp $R0 "1" ${JUMP1} ${JUMP2} !macroend ; Puts in stack the user LANG_ID Function GetUserLangId Push $R0 System::Call 'Kernel32::GetUserDefaultLangID(v) i() .r10' Exch $R0 FunctionEnd Function .onInit Call GetUserLangId Pop $LANGUAGE StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} 0 +3 ;First compare sublangs MessageBox MB_OK "Protuguese (Brasil) language detected" Goto finishLang !insertmacro COMPARE_NEUTRAL_LANGIDS $LANGUAGE ${LANG_PORTUGUESE} 0 +3 ;For a default Portuguese traslation MessageBox MB_OK "Protuguese language detected" Goto finishLang !insertmacro COMPARE_NEUTRAL_LANGIDS $LANGUAGE ${LANG_ENGLISH} 0 +3 MessageBox MB_OK "English language detected" Goto finishLang !insertmacro COMPARE_NEUTRAL_LANGIDS $LANGUAGE ${LANG_SPANISH} 0 +3 MessageBox MB_OK "Spanish language detected" Goto finishLang ;default MessageBox MB_OK "No language detected, using default language" finishLang: Abort FunctionEnd Section "" SectionEnd