- NSIS Discussion
- RegionalSetting and LocaleSettings Problem
Archive: RegionalSetting and LocaleSettings Problem
dbach
31st May 2006 16:48 UTC
RegionalSetting and LocaleSettings Problem
Hi community.
Today I ran into a little problem.
I need to use the Regional-Language-Settings for my Installer (MUI, MultiLanguage) instead of the SystemLanguage. I realised this using the "System::Call "kernel32::GetUserDefaultLangID()i.a"" message at .oninit.
But know what makes me go nuts ...
MessageBoxes "after" the .OnInit are shown in SytemLanguage, the InstallationPages are shown in RegionalLanguage!
A little example
***91;...***93;
LangString LESS_MEM ${LANG_ENGLISH} "This system has $R0 MB Memory but 1536 MB is at least required. Continue Installation?"
LangString LESS_MEM ${LANG_FRENCH} "Ce système a $R0 Mo de mémoire principal mais au moins 1536 Mo sont requis. Continuer l'installation?"
LangString LESS_MEM ${LANG_GERMAN} "Dieses System hat $R0 MB Arbeitsspeicher, vorrausgesetzt werden aber 1536 MB. Installation fortfahren?"
LangString LESS_MEM ${LANG_ITALIAN} "Il sistema dispone di $R0 MB di memoria principale. Sono necessari almeno 1536 MB. Continuare l'installazione?"
LangString LESS_MEM ${LANG_SPANISH} "Este sistema dispone de $R0 MB de memoria principal, sin embargo se necesitan 1536 MB. ¿Desea continuar la instalación?"
>***91;...***93;
Function .onInit
System
::Call "kernel32::GetUserDefaultLangID()i.a"
>***91;... also in/on .onInit ...***93;
>HwInfo::GetSystemMemory
StrCpy $R0$0
${If} $R0 < 1536
MessageBox MB_YESNO"$(LESS_MEM)" IDYES GetSystemMemoryEnd IDNO +1
Abort
${EndIf}
>GetSystemMemoryEnd:
***91;...***93;
My testenvironment is a WinXP in english with language set to french. All install pages are french, the messageboxes english. What I am doing wrong?! :(
Thank you for any support or help. Please excuse my bad english. :)
Afrow UK
31st May 2006 21:02 UTC
So you're calling GetUserDefaultLangID, but where is its return value going? Should you be storing its return value in $LANGUAGE or something?
-Stu
dbach
1st June 2006 08:12 UTC
Originally posted by Afrow UK
So you're calling GetUserDefaultLangID, but where is its return value going? Should you be storing its return value in $LANGUAGE or something?
Hi stu. First, thanks for your reply.
The problem is that I never used the WinAPI before and I am not that familiar with that one. But I noticed that after I did this setting in the .oninit section all my pages (except messageboxes) where localised. So I tough that it was correct. But know I see I have to put the Result to a String ... didn't know that one. I will try it and then report back if it fails. ;-)
Once again, thank you very much for your support. I already saw that you helped a lot of people here. Did you ever tought about adding a donate button to your signature? Maybe someone could use it ... ;-)
dbach
1st June 2006 09:39 UTC
Originally posted by Afrow UK
So you're calling GetUserDefaultLangID, but where is its return value going? Should you be storing its return value in $LANGUAGE or something?
-Stu
Well, I tried what you said.
Function .onInit
messagebox MB_OK $language; Shows 1033 (english)
>System::Call "kernel32::GetUserDefaultLangID()i .r0"
>messagebox MB_OK $0 ; Shows 1036 (french)
>StrCpy $LANGUAGE $0 ; Copies the value to $LANGUAGE
MessageBox MB_OK${LANG_FRENCH} ; Just to be sure -> shows also 1036 (french)
... but ... all my dialogs (I only have messageboxes in the .oninit section) are still in english, the installer pages are in french.
Quote of the manual (variables):
$LANGUAGE
The identifier of the language that is currently used. For example, English is 1033. You can change this variable in .onInit.
Maybe I am still missing something?! I don't know what to do. I really need help here.
Thank you for any support/reply.
Edit: Yes, I use !insertmacro before my LangStrings ...
kichik
1st June 2006 09:53 UTC
`a` is the System's plug-in name for the $LANGUGE variable. That line already saves the value to the $LANGUAGE variable.
The problem is that changing $LANGUAGE only takes affect after .onInit.
dbach
1st June 2006 10:03 UTC
Originally posted by kichik
`a` is the System's plug-in name for the $LANGUGE variable. That line already saves the value to the $LANGUAGE variable.
The problem is that changing $LANGUAGE only takes affect after .onInit.
Thanks for that information.
... well, bcs. time is running out and I am under deep pressure I wrote a workaroung:
; GetSystemMemory
HwInfo::GetSystemMemory
StrCpy $R0$0
${If} $R0 < 1536
Detailprint "This system has less memory then required!"
${If} $LANGUAGE == ${LANG_FRENCH}
MessageBox MB_YESNO "Ce système a $R0 Mo de mémoire principal mais au moins 1536 Mo sont requis. Continuer l'installation?" IDYES GetSystemMemoryEnd IDNO +1
Abort
${ElseIf} $LANGUAGE == ${LANG_GERMAN}
MessageBox MB_YESNO "Dieses System hat $R0 MB Arbeitsspeicher, vorrausgesetzt werden aber 1536 MB. Installation fortfahren?" IDYES GetSystemMemoryEnd IDNO +1
Abort
${ElseIf} $LANGUAGE == ${LANG_ITALIAN}
MessageBox MB_YESNO "Il sistema dispone di $R0 MB di memoria principale. Sono necessari almeno 1536 MB. Continuare l'installazione?" IDYES GetSystemMemoryEnd IDNO +1
Abort
${ElseIf} $LANGUAGE == ${LANG_SPANISH}
MessageBox MB_YESNO "Este sistema dispone de $R0 MB de memoria principal, sin embargo se necesitan 1536 MB. ¿Desea continuar la instalación?" IDYES GetSystemMemoryEnd IDNO +1
Abort
${Else}
MessageBox MB_YESNO "This system has $R0 MB Memory but 1536 MB is at least required. Continue Installation?" IDYES GetSystemMemoryEnd IDNO +1
Abort
${EndIf}
${Else}
Detailprint "System has $R0 Memory"
${EndIf}
>GetSystemMemoryEnd:
... and that for many many many many customized dialogs. :(
Thank you anyway guys.
kichik
1st June 2006 10:09 UTC
You can use something like the following for smaller code:
http://forums.winamp.com/showthread....witch+language