Beorne
15th September 2005 10:20 UTC
defining wich language file from a configuration file
Up to now I defined wich language file to use with NSIS with:
!ifdef ITA
LoadLanguageFile 'Italian.nlf'
!endif
Now I have an external configuration file containing my deploy configuration (includung the language) that I read with the very useful command
${ConfigRead} 'configfile' 'Language = ? $R5
But the latter is an instruction that has to be in a section, and LoadLanguageFile is a command that cannot be placed in a section.
How could I read a configuration file and on the basis of the parameter load the right language file?
Thank you very much
Yathosho
15th September 2005 10:23 UTC
in my installer i'm using this in the onInit function
ReadINIStr $0 "$EXEDIR\rwparam.ini" "RunWithParameters" "Language"
StrCpy $LANGUAGE "$0"
that StrCpy command shouldn't be necessary in your script, just use $LANGUAGE in the ReadINIStr command.
Beorne
15th September 2005 14:27 UTC
This does not resolve my problem
I have put
${ConfigRead} "configfile" "lang = " $R5
StrCpy $LANGUAGE $R5
in OnInit but don't work
I have to read the language from a parameter file, then set the default NSIS strings to that language, like using
LoadLanguageFile "C:\Italian.nlf"
Simply put I have to localize the installer on the basis of a parameter on file
glory_man
15th September 2005 16:13 UTC
${ConfigRead} "configfile" "lang = " $R5
MessageBox MB_OK "Language - $R5"
StrCpy $LANGUAGE $R5
What does this MB show?
And attach script (if you can).
onad
15th September 2005 16:23 UTC
Multilingual example in Moreinfo plugin
Multilingual example in Moreinfo
Multilingual example in Moreinfo plugin. Multi language in an easy extensible way in one of the demos. Will solve a lot of multilanguage language problems.
The "CustomLanguageDemo" Fully shows the power of getting the OS GUI language. I the demo a good example of how custompage localization works and could be implemented.
See the Wikipage
http://nsis.sourceforge.net/wiki/MoreInfo_plug-in
Or take a look in:
http://forums.winamp.com/showthread...hlight=moreinfo
Just try the "CustomLanguageDemo" demo included.
Beorne
16th September 2005 09:01 UTC
Quote:
Function .onInit
${ConfigRead} "configfile" "lang = " $R5
StrCpy $LANGUAGE $R5
MessageBox MB_OK "Language - $LANGUAGE"
FunctionEnd
It shows me correcty "Language = Italian"
That is the value of the lang parameter
But the writings on the installer are not in Italian
If I put
MessageBox MB_OK "language2 = $LANGUAGE"
in another section, it shows me "language2 = 1033"
I don't wont to give different language options in the moment of the installation of the application. I'd like, at the moment of the compiling of the .nsi installer, to compile it with a languge set defined in a separate config file, like the effect obtained by using
LoadLanguageFile 'C:\Programmi\NSIS\Contrib\Language files\Italian.nlf'.
But I want to load a different language set on the basis of an external parameter.
I don'know if I have explained me well and I don't know if this is possible.
Originally posted by glory_man
${ConfigRead} "configfile" "lang = " $R5 MessageBox MB_OK "Language - $R5"
StrCpy $LANGUAGE $R5
What does this MB show?
And attach script (if you can).
|
glory_man
16th September 2005 11:04 UTC
You need to use constant (like ${LANG_ENGLISH}, ${LANG_ITALIAN}, etc) or language ID (1033-for English, 1040-for italian, etc) to set right language.