Hi,

I struggled with this concept a month back when I first started.

You would want to use a bootstrapping tool (I use autoit) in order to apply the 
transform to the installer, instead of having a dialog within wix. As the 
transform happens at the launch of the msi.
Below is some example code that you can compile in autoit, which I have created 
for this very purpose:

------------------------
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         David Amey

 Script Function:
        language selector utility to apply transform to msi, and add lcid value 
in registry.
        
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars',1)

Global $productName = "Enter a name here"
Global $install, $cancel, $lang, $selected

languageSelector()

Func languageSelector()
        
        Local $msg
        GUICreate($productName,300, 110)
        ;textBox
        GUICtrlCreateLabel("Please select the language you would like to 
install",10,10)
        ;combo box
        $lang = GUICtrlCreateCombo("",15,40,180)
        ;the "|" character enables you to list the languages in the combo box. 
the third element is the default selection for the combo box
        GUICtrlSetData(-1,"English - UK|English - US|French|Italian","English - 
US")
        ;install button
        $install = GUICtrlCreateButton("Install",180,80,50)
        ;cancel button
        $cancel = GUICtrlCreateButton("Cancel",240,80,50)
        
        GUISetState(@SW_SHOW)
        
        While 1
                $msg = GUIGetMsg()
                
                Select
                        Case $msg = $GUI_EVENT_CLOSE
                                Exit
                        Case $msg = $install
                                $selected = GUICtrlRead($lang)
                                lcid()
                                Exit
                        Case $msg = $cancel
                                Exit
                EndSelect
        WEnd
        GUIDelete()
EndFunc 

;translates selected language into correct lcid value which is stored in 
registry (you may need as well)
Func lcid()
        ;there is prob a better way to do this translation process, 
        Local $code
        ;dont currently have en-gb.mst
        If $selected = "English - UK" Then 
                $selected = "2057" 
                $code = "en-gb"
        ElseIf $selected = "English - US" Then 
                $selected = "1033"
        ElseIf $selected = "French" Then 
                $selected = "1036" 
                $code = "fr-fr"
        ElseIf $selected = "Italian" Then 
                $selected = "1040" 
                $code = "it-it"
        EndIf
        
        ;enters the lcid value in the registry.
        
RegWrite("HKEY_CURRENT_USER\Software\YourInstaller","lcid","REG_SZ",$selected)
        ;--if the selected language isn’t us English then it will apply a 
transform, if not, then it won't need a transform applied to it.
        if $selected <> "1033" Then
                RunWait('msiexec TRANSFORMS="' & @ScriptDir & '\'&$code&'.MST" 
/i"' & @ScriptDir & '\YourInstaller.msi"')
        Else
                ShellExecute(@ScriptDir & '\YourInstaller.msi')
        EndIf
        
EndFunc
------------------------------------- end of code

Hope this helps.

Dave

-----Original Message-----
From: lxy.su...@gmail.com [mailto:lxy.su...@gmail.com] 
Sent: 21 October 2010 10:07
To: WiX-users@lists.sourceforge.net
Subject: [WiX-users] [Multiple- languanges support] Combox and TRANSFORMSissues

Hi,
I am a new commer of Wix and now I am trying to use a ComBox to support 
multiple languages when displaying the installer wizard.
The value user choose can be passed to the property I set, but the issues is 
that how can I change the public property -TRANSFORMS to the .mst file I just 
choose?

Is anyone have a better solution to do that?

Thanks!
Ps, I have already embeded the mst file into the msi, and the combox samples 
are as follows:

*<**ComboBox Property="*TRANSFORMS *"**>*

*<**ListItem Text="English" Value=":en-us.mst" />*
**

*<ListItem Text="Spanish" Value=":es-es.mst"** />*

*<**ListItem Text="Japanese" Value="jp-jp.mst"** />*

*</**ComboBox>*
**

<Dialog Id="LanguageChooseDialog" Height="97" Width="217" Title="Installer 
Language" NoMinimize="yes">

*<**Control Id="LanguageChooseComboBox" Type="ComboBox" X="52" Y="48" Width= 
"156" Height="10" ComboList="yes" Property="***TRANSFORMS ***" Sorted="no"
RightToLeft="yes"**>*

*<**Text>English</Text**>*

*</**Control**>*


--
天行健,君子以自强不息
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest 
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing 
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev 
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to