coco_vc
4th April 2006 16:23 UTC
multilanguage support - recommended solution
Hi all,
I have in my script stuff like this:
LangString AdminMsg ${LANG_ENGLISH} "You need to have full admin rights to install the product"
LangString AdminMsg ${LANG_FRENCH} "FRENCH -> You need to have full admin rights to install the product"
and also code like the following (needed for having the $LANGUAGE switch in onInit):
!define NEED_SPECIFIC_OS_AND_SP_LANG_ENGLISH "You need Windows 2000 SP3 and up"
!define NEED_SPECIFIC_OS_AND_SP_LANG_FRENCH "FRENCH -> You need Windows 2000 SP3 and up"
I was thinking of doing the following:
- have 2 files eg: my_english.nsh and my_french.nsh which will contain the above code
- include these 2 files in my script
- give the .nsh files out for translation
Questions:
1) Would this be a way of adding multi-language support to my script? Is there another recommended way?
2) What if one of the .nsh files contain a language that needs unicode? Do I need to do something special for those?
Thx,
Viv
Afrow UK
4th April 2006 17:48 UTC
That should be fine. If you take a look under Contrib\Modern UI\Language files, plain text (.nsh) files are used.
-Stu
coco_vc
5th May 2006 12:12 UTC
I started to work on this issue as described in my first entry but I get some warnings and I don't understand why.
So what I did was just moving some defines into external .nsh files, so that I now have:
myMainFile.nsi:
!include "myEnglish.nsh"
!include "myFrench.nsh"
myEnglish.nsh:
LangString InstallRedirPlsWait ${LANG_ENGLISH} "Installing the redirector, please wait ..."
myFrench.nsh
LangString InstallRedirPlsWait ${LANG_FRENCH} "FRENCH -> Installing the redirector, please wait ..."
Now when building the nsi file I get the following 2 warnings (for each set of string I have in the external files):
1)
!include: closed: "myEnglish.nsh"
!include: "myFrench.nsh"
warning: LangString "InstallRedirPlsWait" set multiple times for 0, wasting space (myFrench.nsh:6)
LangString: "InstallRedirPlsWait" 0 "FRENCH -> Installing the redirector, please wait ..."
2)
Removing unused resources... Done!
Generating language tables... warning: LangString "InstallRedirPlsWait" is not set in language table of language French
warning: LangString "InstallRedirDone" is not set in language table of language French
Can someone pls tell me what am I doing wrong? If all those strings are into the main .nsi file everything is fine. I just moved them in diff .nsh files specific for languages and I started to have these warnings.
Thx,
Viv
coco_vc
5th May 2006 14:03 UTC
Found the problem: the includes should be after the !insertmacro MUI_LANGUAGE so the order should be like:
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!include "myEnglish.nsh"
!include "myFrench.nsh"
Viv