Archive: Strange new behaviour in LangStrings + InstallDir + Name


Strange new behaviour in LangStrings + InstallDir + Name
When updating to a new version of NSIS I found out that the default language is now selected by NSIS.

Since I have different application titles(and data) depending on the language selected the following stopped working(MUI):

Name $(appName)
InstallDir "$PROGRAMFILES\$(appName)"
...
LangString appName ${LANG_ENGLISH} "Reading World Demo"
LangString appName ${LANG_ITALIAN} "Lettere e Parole Demo"

Before the Name and InstallDir $(appName) was the same but now InstallDir selects the title and data depending on the OS lang. Name works as before though.

What is the recommended way of restoring the "old way"?

Suddenly I feel like a little bit of freedom has been stolen from the great NSIS.


From the release notes of version 2.13:

Language detection has changed. The default language is now set to the user's user-interface language instead of the locale language, as suggested by MSDN. To restore the old behavior, use System::Call "kernel32::GetUserDefaultLangID()i.a" in .onInit.
That's the only thing that has changed in a long time concerning languages.

The different language of $INSTDIR and the title comes from an unrelated issue. $INSTDIR is initialized from InstallDir before .onInit and before the user has a chance to change the language. Therefore, if you're using LangStrings in it, you should recalculate it after the language changes. You can do it with a switch in .onInit or by using the LangString in .onGUIInit.