- NSIS Discussion
- Setting the language on .myGuiInit
Archive: Setting the language on .myGuiInit
bennaloz
20th January 2012 08:49 UTC
Setting the language on .myGuiInit
I saw I think every thread about this. I understood that I can get parameters in .myGuiInit with ${GetParameters}. When I run a .exe file from another setup I write this
ExecWait '" $DESKTOP\myfolder\myexefile.exe" $LANGUAGE' $0
because I want that myexefile.exe is of the same language of the main setup.
in myexefile.exe in .myGuiInit function I wrote this code
Function .myGuiInit
${GetParameters} $0
FunctionEnd
In $0 variable I find the language code sent by exec for example for italian I found 1040, for spanish 1034 of for french 1036 anyway I found the right code of the chosen language.
I tried setting $LANGUAGE with this code or with ${LANG_SPANISH} if I found the spanish code but this way doesn't work. Installation files page is shown in italian.(my OS language)
How can I make the language change according to the code in .myGuiInit?
I hope I was clear my english sucks
Thnks
Yathosho
20th January 2012 09:40 UTC
1. i'd probably add a switch to make sure you get only the language code (eg /L=$LANGUAGE)
2. according to languages.nsi, you should set the language in the onInit function
bennaloz
20th January 2012 09:54 UTC
So have I to load the correct language file corresponding to the input language code?
Edit: I didn't say I am using MUI_LANGDLL_DISPLAY onInit to set the installer language
Yathosho
20th January 2012 10:31 UTC
Originally posted by bennaloz
I didn't say I am using MUI_LANGDLL_DISPLAY onInit to set the installer language
you didn't, but it still demonstrates how to do it: StrCpy $LANGUAGE <LANG_ID>
or
;commandline should contain /L=<LANG_ID>
${GetParameters} $0
${GetOptions} $0 "/L=" $LANGUAGE
bennaloz
20th January 2012 12:05 UTC
Originally posted by Yathosho
StrCpy $LANGUAGE <LANG_ID>
<LANG_ID> means 1040 for italian or means ${LANG_ITALIAN}?
Because I tried but it seems not work. I did it in .onInit function.
bennaloz
20th January 2012 12:19 UTC
Originally posted by Yathosho
;commandline should contain /L=<LANG_ID>
${GetParameters} $0
${GetOptions} $0 "/L=" $LANGUAGE
Instead when I write this code on .onInit function $LANGUAGE is empty and $0 contains the language code.
If I chose spanish in $0 I find 1034 and writing
StrCpy $LANGUAGE $0
the installer remain in italian. I can't understand where I am wrong
bennaloz
24th January 2012 08:43 UTC
Function .onInit
StrCpy $LANGUAGE 2057 ;to set the english setup language does not work
FunctionEnd
or
Function .onInit
${GetParameters} $0
${GetOptions} $0 "/L=" $LANGUAGE
FunctionEnd
I think $0 must contain <LANG_ID> (for example 1040,2057 it depeds) but it's empty.
So how can i get it work?
Afrow UK
24th January 2012 12:25 UTC
How have you run your setup executable? As Yathosho says you need to give it /L=#.
Stu
bennaloz
25th January 2012 07:33 UTC
I run ExecWait '"MySetup.exe" <LANG_ID>' without /l. I thought it was the same retrieving the <LANG_ID> on .onInit function and put it in $LANGUAGE without look for /l. Ok now it works with
ExecWait '"mysetup.exe" /l $LANGUAGE'
and onInit ${GetOptions} $0 /l $LANGUAGE
but If I chose French when I exec mysetup.exe I found in $LANGUAGE 1036 (french lang_id), but mysetup.exe is in english -.-'' and my OS is italian. Mmm boh. :confused:
Am I forgetting something?
Edit: When I run mysetup.exe I found the right languade id onInit but then I checked again $LANGUAGE while installation is in progress and I found 1033 (english U.S.) I tried with different languages and the result is the same. I found during the installation 1033. I think I am forgetting something to set the language.
Another clarification... I am using Unicode nsis. If it makes some difference
Afrow UK
25th January 2012 10:44 UTC
Look at section 4.10.1 in the manual.
Stu
bennaloz
25th January 2012 12:13 UTC
Originally posted by Afrow UK
Look at section 4.10.1 in the manual.
Already read it.Infact my first language is english like it sais. I am sorry I was sure english means UK english and not US english. Now I tried to print $LANGUAGE if I chose english and it's 1033. Solved. I didn't put !insertmacro MUI_LANGUAGE in every setup -.-'' I didn't think it was necessary surely you thought it was obvoius. Thanks for the patience. Anyway How can I load UK English? I checked in MultiLanguages.nsi but I found only English (1033 is US english while 2057 is UK english).I should need 2057. Do you know or somebody else know it?
Afrow UK
25th January 2012 12:19 UTC
You need to create your own nlf and nsh file for it (you can submit it as well in the translations forum).
Stu
bennaloz
25th January 2012 12:27 UTC
Originally posted by Afrow UK
You need to create your own nlf and nsh file for it (you can submit it as well in the translations forum).
Ok I'll see. Thank you again