Red27
5th April 2008 02:21 UTC
Output Language choice to Config File
Hi there,
I am trying to output the language selected by the user for the install to a config.txt file in the Installation directory (for use by the actual installed application).
Essentially, I need the config.txt file to contain an entry
language=eng
(or language=fra, language=deu etc depending on presumably (?) the $LANGUAGE variable)
Can anyone help me to do this?
Apologies if this is a completely noob question; I did search the forums but could not find anything specifically relating to this.
Many thanks,
Pete.
Red Wine
5th April 2008 10:36 UTC
See the included example languages.nsi on section number two.
Instead of a message box, write config.txt with FileOpen FileWrite FileClose.
Red27
6th April 2008 00:47 UTC
Thanks for the reply.
I'm still not entirely sure I know what to do though; the example language.nsi mentions "old slow" way.
Would anyone have a real world (new) example of how to achieve this?
Thanks again,
Pete.
wag2639
8th April 2008 07:54 UTC
I just figured this out last week :)
If you are using !insertmacro MUI_LANGDLL_DISPLAY, it sets a ${LANGUAGE} variable thats mostly useless do you cause its just a number.
My way around this, and its not the most elegant, is to use a LangString to say which language I am in text.
LangString MY_LANGUAGE ${LANG_ENGLISH} "english"
LangString MY_LANGUAGE ${LANG_MALAY} "malay"
...
You'll have to make a list for all the languages you heave available.
To write this stuff to a config file: (here's a striped version of mine)
Section -WriteMyLang
FileOpen $9 "$INSTDIR\config.txt" w ;Opens a Empty File an fills it
FileWrite $9 "myLanguage$\t$(MY_LANGUAGE)$\r$\n"
#FileWrite $9 "my_id $\t$0$\r$\n"
FileClose $9 ;Closes the filled file
SectionEnd
Red27
8th April 2008 10:04 UTC
Wag,
Thanks for that, I'll try that!
Red.