Page 1 of 1

GetSystemLanguage() return value

Posted: Fri Aug 16, 2019 12:47 am
by NubeCheCorre
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:


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!

Re: GetSystemLanguage() return value

Posted: Fri Aug 16, 2019 7:34 am
by jPV
You can compare the result from GetSystemLanguage() to those constants to figure out which language is in use.

For example like this:

Code: Select all

lang = GetSystemLanguage()
Switch lang
    ; Do your Italian stuff here.
    ; Do your French stuff here.
    ; Do it in English.
Or use GetLanguageInfo() to get the language in written forms:

Code: Select all

t = GetLanguageInfo(lang)
DebugPrint(t.Code, t.Name) 

Re: GetSystemLanguage() return value

Posted: Fri Aug 16, 2019 8:27 am
by Bugala
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



except that the value of variable x can change, for example


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.

Re: GetSystemLanguage() return value

Posted: Fri Aug 16, 2019 3:24 pm
by NubeCheCorre
Thanks to both for the explanations and the examples :-)