Archive: Language detection


Language detection
  Hello,
how can I let NSIS detect which language is given by the system?
And can I use this information to select/deselect some InstallOptions? (For example some translations for an application)


;1033 == English
StrCmp $LANGUAGE 1033 0 +2
WriteINIStr "IOfile.ini" "Field X" "State" "1" ;select check-box


-Stu

Thank you,
but how do I use this piece of code?
I'm sorry :(


Ok, I now know how to use it.
But it does nothing.
No Section is selected or deselected if I write "0" instead if "1"

This is my code:


onInit

StrCmp $LANGUAGE 1033 0+2
WriteINIStr"IOfile.ini" "Group En" "State" "1" ;select check-box
FunctionEnd

SubSection/e "En / Ger" SEC00
Section/o "Group En" SEC01
SectionEnd

Section/o "Group Ger" SEC02
SectionEnd
SubSectionEnd
>

A long time did a multilanguage installer... with some of your code & mine:


SetCompressor lzma
XPStyle on

Name "Lobo Lunar"
OutFile "Test.exe"
BrandingText "Lobo Lunar"
InstallDir "$EXEDIR"
ShowInstDetails show

Page components
Page instfiles

SubSection "Languages"

Section /o "English" english
; Put stuff
SectionEnd

Section /o "Other" other
; More stuff
SectionEnd

SubSectionEnd

Function .onInit
StrCmp $LANGUAGE 2058 ENG OTHER

ENG:
SectionSetFlags ${english} 1
Goto Exit

OTHER:
WriteINIStr "$EXEDIR\myini.ini" "LANG" "ID" "1"
SectionSetFlags ${other} 1

Exit:
FunctionEnd

Thank you, I'm testing the script now.
/edit: Works great your script!


Great! :up:

As you can see, SectionSetFlags is your man :)


[QUOTE]Originally posted by Afrow UK
[B]

;1033 == English
StrCmp $LANGUAGE 1033 0 +2
WriteINIStr "IOfile.ini" "Field X" "State" "1" ;select check-box


This will check the language selected for the installation. This might not be the OS language. How can I detect the language of the operating system!?

As far as I know, $LANGUAGE will contain the OS language unless you change it via LangDLL

-Stu