Archive: Multilanguage support - A big problem


Multilanguage support - A big problem
  I have some experience in creating multilanguage applications. The best solution, from my experience, is to create language files but it seams that NSIS does not have support for this. (I'm not reffering to standard language files).

As you know, you'll need at some time to display a message like "This application is old" but the NSIS can't do the translation in other languages so someone else well do the translation for him. But the translator is not a programmer ! So the only solution is to include in the script only macros like LANG_MSG_APP_OLD and create language files like:

English.lng
LANG_MSG_APP_OLD "This application is ols."

Does anyone know how can we do this?


You can use a simple macro for now just like the MUI does.


Creating language files and integrating with MUI is fairly simple.

First create these macros in your installer:

!macro LANG_LOAD LANG

!insertmacro MUI_LANGUAGE "${LANG}"
!verbose off
!include "locallang\${LANG}.nsh"
!verbose on
BrandingText"$(STRING_BRANDING)" ; example usage
!undef LANG
>!macroend

>!macro LANG_STRING NAME VALUE
LangString "${NAME}" "${LANG_${LANG}}" "${VALUE}"
>!macroend

>!macro LANG_UNSTRING NAME VALUE
!insertmacro LANG_STRING "un.${NAME}" "${VALUE}"
>!macroend
>
Then make your language files like:

Must be the lang name define my NSIS

>!insertmacro LANG_STRING STRING_BRANDING "My Setup"
>!insertmacro LANG_STRING STRING_APP_OLD "This application is ols."
If you create language files (ie "English.nsh") in the directory ("locallang" in this example), then in the head of your installer, you just say:

!insertmacro LANG_LOAD "English" 
and it will load the MUI, NSIS, and your local language files.

Add it to the archive, if it isn't already, Sunjammer.