Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Is there a way to insert specific macro language with MUI (http://forums.winamp.com/showthread.php?t=313257)

webtubbies 2nd October 2009 13:36

Is there a way to insert specific macro language with MUI
 
Hello,

I'm trying to use the '!insertmacro MUI_LANGUAGE "myLMang"' in a specific way.

First i have one install which store the language the user chose.
PHP Code:

!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY "SOFTWARE\${Registry}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "${Langinstall}

Then the second installer get the language in the registry (i.e. 1033 for English). The installer doesn't display language listBox.
So I want insert the right language in the script (here " !insertmacro MUI_LANGUAGE "English" "

My problem is that I can't use this macro in a function and I can't use switch case out of a function.

Does anyone got an Idea to help my poor brain...?
Here's my code:
PHP Code:

${Switch} $LANGUAGE
    
${Case} '1033'
        
!insertmacro MUI_LANGUAGE "English"
        
${Break}
    ${Case}  
'1036'
        
!insertmacro MUI_LANGUAGE "French"
        
${Break}
    ${Default}
        ${Break}
${EndSwitch} 


pengyou 3rd October 2009 12:37

I am not sure what you are trying to do.

You have two installers. The first one offers a choice of languages (English and French?). This installer stores the selected language in the registry.

After you have run the first installer you want to run another installer. The second installer is to use whatever language was selected when the first installer was run.

I think your problem is that you do not know how to make the second installer use the correct language.

Have you looked at the multi-language MUI example that comes with NSIS?

Try compiling the Examples\Modern UI\MultiLanguage.nsi script to make the MultiLanguage.exe demo installer.

The first time I ran MultiLanguage.exe on my English version of Windows it showed a language selection dialog with "English" pre-selected. I used the dialog box to select "French" and ran the demo installer (and all the pages were in French).

After the installer finished, I ran MultiLanguage.exe again. This time it did not show the language selection dialog so the very first thing that appeared was the License page and that was all in French (even though I was running it on an English version of Windows). This happened because the installer was using the language setting stored in the registry.

Yathosho 3rd October 2009 17:59

leave your macros outside the section, where they belong. to switch the language you just need to do this:
code:
StrCpy $LANGUAGE "1033"

i guess you have to use this before your GUI is initialized (onInit or onGUIInit).

unless you need the language stores in the registry permanently, i think it's good practice to execut second installer with a parameter (mySetup.exe /L=1033).

http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.12

webtubbies 5th October 2009 07:56

Quote:

Originally posted by pengyou
I am not sure what you are trying to do.

You have two installers. The first one offers a choice of languages (English and French?). This installer stores the selected language in the registry.

After you have run the first installer you want to run another installer. The second installer is to use whatever language was selected when the first installer was run.

Yes that's the point. I have to have a close look to the example MultiLanguage.nsi.

Quote:

to switch the language you just need to do this:

code:--------------------------------------------------------------------------------StrCpy $LANGUAGE "1033"--------------------------------------------------------------------------------
i guess you have to use this before your GUI is initialized (onInit or onGUIInit).

That's what I've done with no success...

Use the switch /L with the installer is a good advice. I'll try it. But at this time it's an external program (i.e. I can't handle it) which calls my second installer.

Thank you both. I'll be back to tell you if i can find a fix :)

webtubbies 5th October 2009 08:55

Ok, It's working now.
What I have done in the second installer is:

Put these lines:
PHP Code:

!define MUI_LANGDLL_REGISTRY_ROOT HKLM 
!define MUI_LANGDLL_REGISTRY_KEY "SOFTWARE\${Registry}" 
!define MUI_LANGDLL_REGISTRY_VALUENAME "${Langinstall}

then in the OnInit:
PHP Code:

!insertmacro MUI_LANGDLL_DISPLAY 

First I thought,that copying the registry value (1033 or 1036) in the $LANGUAGE variable was enough.
According to the MUI documentation:
!If you want the installer to display a language selection dialog (see the the MultiLanguage.nsi example), insert the MUI_LANGDLL_DISPLAY macro in the .onInit function

So i don't understand why I have to insert this code, because I don't want the language listBox. And in this case it's not shown... Did I miss something?

Anyhow, it's working now.

Thank You.

pengyou 5th October 2009 10:13

Quote:

So i don't understand why I have to insert this code, because I don't want the language listBox. And in this case it's not shown... Did I miss something?
The language selection dialog will only appear if no language setting is found in the registry. I mentioned this in my earlier message (the first time I ran the demo I saw the dialog but the second time I ran the demo the box did not appear).

There is another MUI setting you can use if you ALWAYS want the language selection dialog to appear. See the MUI readme:
Quote:

To customize the language selection dialog interface, use these defines before inserting the MUI_LANGDLL_DISPLAY macro.

MUI_LANGDLL_ALWAYSSHOW
Always show the language selection dialog, even if a language has been stored in the registry. The language stored in the registry will be selected by default.

webtubbies 5th October 2009 10:26

Damn,

I did not read the entire section. Sorry about that.

pengyou 5th October 2009 10:36

Don't worry about that. I have read the documents lots of times and still find new things in them.


All times are GMT. The time now is 17:24.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.