Is it possible to localize EULA in WiX using a .wxl file?

My installer created by wth WiX is localized via .wxl files. You can specify several cultures on WiX, and light.exe will be called several times, creating an installer for each language (this is available when installing the installer from Visual Studio).

All work files except EULA. It is defined in the .wxs file via

<WixVariable Id='WixUILicenseRtf' Value='en.rtf' /> 

And I don’t know a good way to change this value from the .wxl localization file. Using

 <WixVariable Id='WixUILicenseRtf' Value='!(loc.EulaFile)' /> <String Id='EulaFile'>en.rtf</String> 

It does not work, sys.wxl files are used in link-time, and .wxs is compiled before them, so the compiler cannot find !(loc.EulaFile) . Searching Forums I found two workarounds. Firstly, to create a custom license dialog box for each language - it seems to work, but it is very complex and rich source code. The second way is to abandon the assembly of Visual Studio / Votive and call light.exe several times, each time indicating each license file through the -d command line switch.

Is it possible to solve this problem and use localized EULA files so that a project can be created in VisualStudio + Voltive without having to copy many dialogs? Localizing installers is a very common problem, so maybe there is some solution that I don’t know about?

+6
wix votive
source share
3 answers

There is another way to do this, and although it is a bit dirty, it is less dirty than the two workarounds that the OP mentioned. And the loan for which the loan is calculated, this answer is almost 100% based on this message http://weblogs.sqlteam.com/mladenp/archive/2010/04/15/WiX-3-Tutorial-Custom-EULA-License- and-MSI-localization.aspx Mladen Pridech.

The following is a description of WiX 3.5.

You create a slightly modified copy of the LicenseAgreementDlg dialog and include it in your project.

 <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) Microsoft Corporation. All rights reserved. The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php) which can be found in the file CPL.TXT at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software. --> <!-- This is a modified version of LicenseAgreementDlg to support selection of localized versions of the license file. It is very much based on this article: http://sqlserverpedia.com/blog/sql-server-bloggers/wix-3-tutorial-custom-eula-license-and-msi-localization/ --> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Fragment> <UI> <Dialog Id="LicenseAgreementKludge" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)"> <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" /> <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" /> <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" /> <Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" /> <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" /> <Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAcceptedKludge" Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" /> <Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)"> <Publish Event="DoAction" Value="WixUIPrintEula">1</Publish> </Control> <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" /> <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)"> <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish> <Condition Action="disable"><![CDATA[LicenseAcceptedKludge <> "1"]]></Condition> <Condition Action="enable">LicenseAcceptedKludge = "1"</Condition> </Control> <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)"> <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> </Control> <Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no"> <Text SourceFile="$(var.ProjectDir)\!(loc.LicenseRtf)" /> <!-- this value has been modified --> </Control> </Dialog> </UI> </Fragment> </Wix> 

In the WiX main source file, you added the following code to β€œfix” the new dialog in the dialog sequence instead of the original:

  <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementKludge">1</Publish> <Publish Dialog="LicenseAgreementKludge" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish> <Publish Dialog="LicenseAgreementKludge" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAcceptedKludge = "1"</Publish> <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementKludge">1</Publish> 

Note that this is based on using the collection of the WixUI_InstallDir dialog box - for other collections such as WixUI_Mondo, you may have to change the above by looking at the source.

Finally, in each of your localization files, you put one line as follows:

 <String Id="LicenseRtf">en-us\MerliniaSMSGatewayLicense.en-us.rtf</String> <String Id="LicenseRtf">da-dk\MerliniaSMSGatewayLicense.da-dk.rtf</String> 

And, of course, you put the localized license file as indicated. I put license files (and localization files) in subfolders, but this is not necessary.

As I said, this is a little dirty, but it works.

+5
source share

The best solution is the simplest, just use the WixUILicenseRtf variable on the command line when specifying the .wxl file.

 light -loc setup_fr-FR.wxl -dWixUILicenseRtf=EULA_fr-FR.rtf ... 

Refer to the User Interface Basics in the Wiki Wiki for more information.

+7
source share

Localization of EULA is very simple. Add a ScrollableText control to one of your dialogs. A reference to the location of the String in the text element of the ScrollableText control.

 <Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no"> <Text>!(loc.License)</Text> </Control> 

Then create a localization file, say, for American English. Name the file en-US.wxl. Create a localization String element in the localization file that uses the identifier specified in the Text element of the ScrollableText element, in which case it is called License. Add the rtf source line of your EULA as the CDATA element of the localization string.

To get raw data, create, for example, an rtf file with the word. Open this rtf file with notepad and copy its contents. Insert this content into the CDATA element of the localization String element. Be sure to omit all spaces between the String and CDATA tags.

The following is an example of a localized String element:

 <String Id="License"><![CDATA[{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Calibri;}} {\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang7\f0\fs22 American EULA.}]]></String> 

Thus, the key to enabling multiple EULAs is to use the raw rtf data in the corresponding localization files.

+1
source share

All Articles