I am using Hollywood version 6.0 to create a very simple installation script.. I was looking for a way to get the system language used by the user that run my script and in the hollywood guide I found this function:
lang$ = GetSystemLanguage()
In the doc there is written that at the moment this function support the following languages:
#LANGUAGE_CROATIAN
#LANGUAGE_CZECH
#LANGUAGE_DANISH
#LANGUAGE_DUTCH
#LANGUAGE_ENGLISH
#LANGUAGE_FINNISH
#LANGUAGE_FRENCH
#LANGUAGE_GERMAN
#LANGUAGE_GREEK
#LANGUAGE_HUNGARIAN
#LANGUAGE_ITALIAN
#LANGUAGE_NORVEGIAN
#LANGUAGE_POLISH
#LANGUAGE_PORTUGUESE
#LANGUAGE_RUSSIAN
#LANGUAGE_SPANISH
#LANGUAGE_SWEDISH
#LANGUAGE_TURKISH
#LANGUAGE_UNKNOWN
For me, all these languages are enough, as I need to detect these three following languages: Italian, French and English.
But when I print the variable with the Print() function it returns a number instead of a string. So how can I know which is the system language used by the user? is there another function to use or am I missing something or doing it in the wrong way?
Thanks in advance for the help!
GetSystemLanguage() return value
- NubeCheCorre
- Posts: 77
- Joined: Mon Mar 19, 2012 1:24 am
- Contact:
Re: GetSystemLanguage() return value
You can compare the result from GetSystemLanguage() to those constants to figure out which language is in use.
For example like this:
Or use GetLanguageInfo() to get the language in written forms:
For example like this:
Code: Select all
lang = GetSystemLanguage()
Switch lang
Case #LANGUAGE_ITALIAN:
; Do your Italian stuff here.
Case #LANGUAGE_FRENCH:
; Do your French stuff here.
Default:
; Do it in English.
EndSwitch
Code: Select all
t = GetLanguageInfo(lang)
DebugPrint(t.Code, t.Name)
Re: GetSystemLanguage() return value
To clarify a bit just in case you are not familiar with this.
for example #LANGUAGE_FINNISH is a constant, which means that it is some number.
It is basically same as
x=1
x+4=5
except that the value of variable x can change, for example
x=1
debugprint(x)
x=2
debugprint(x)
however, constant (const) always stays the same. Once you define it, it can't be changed anymore.
So in practice GetSystemLanguage() returns a number, but for easier human readability, these numbers have also consts assigned to them.
this is not a real example, but just as an example:
These consts might represent for example #LANGUAGE_FINNISH is number 3.
Similarly in makebutton command, #SIMPLEBUTTON constant might also represent 3.
therefore you could even do the language comparison against "wrong" constants, in way of: is getsystemlanguage "#SIMPLEBUTTON"? if yes, then language = Finnish.
for example #LANGUAGE_FINNISH is a constant, which means that it is some number.
It is basically same as
x=1
x+4=5
except that the value of variable x can change, for example
x=1
debugprint(x)
x=2
debugprint(x)
however, constant (const) always stays the same. Once you define it, it can't be changed anymore.
So in practice GetSystemLanguage() returns a number, but for easier human readability, these numbers have also consts assigned to them.
this is not a real example, but just as an example:
These consts might represent for example #LANGUAGE_FINNISH is number 3.
Similarly in makebutton command, #SIMPLEBUTTON constant might also represent 3.
therefore you could even do the language comparison against "wrong" constants, in way of: is getsystemlanguage "#SIMPLEBUTTON"? if yes, then language = Finnish.
- NubeCheCorre
- Posts: 77
- Joined: Mon Mar 19, 2012 1:24 am
- Contact:
Re: GetSystemLanguage() return value
Thanks to both for the explanations and the examples