Archive: Output Language choice to Config File


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.


See the included example languages.nsi on section number two.
Instead of a message box, write config.txt with FileOpen FileWrite FileClose.


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.


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


Wag,

Thanks for that, I'll try that!

Red.