Reputation: 649
I created .msi installer using wix toolset 3.10 . I had localized the installer to be multi-language (just one .msi file that display the language depending on the region settings of windows).
I had created da-DK.mst file and I used wisubstg.vbs to embed the language into the english .msi file so I have one multilingual installer works for both Danish and English but I got two issues
any strings that gets its values from the language files which is WixUI_da-DK.wxl , does not display the correct language it always displays the default language value which is english
the other problem is that the built in strings cut off in the Danish language in some forms .
what is the problem here and how to fix it ? This is My UI from the .wxs file
<UI>
<UIRef Id="WixUI_InstallDir"/>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">1</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Icon Id="icon.ico" SourceFile=".....\Images\Img_app.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchApp)" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<!-- end snippet -->
Upvotes: 0
Views: 1619
Reputation: 4798
If your text is getting cut off you need to change your UI's dimensions.
Whatever control you are using to display that text make its width a bigger number. I can't comment on the "Launch App Name" text always being English since there is not enough information about that UI Control or what text it is displaying. You would need to add some more information about the UI you are using.
Here's a link to the default dialogs for wix https://github.com/wixtoolset/wix3/tree/develop/src/ext/UIExtension/wixlib
In the browsedlg.wxs you have this control defined.
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.BrowseDlgDescription)" />
unfortunately, Danish is rather long for the description here and so the installer cuts off the text and uses an ellipses.
I think the easiest way to fix this is to add a new wxs file to your project called AppNameBrowseDlg.wxs and just copy in the whole xml from here https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/BrowseDlg.wxs . You will need to change the <Dialog> Id to be "AppNameBrowseDlg" as well. Now you can make the width of the Description control bigger so hopefully the Danish text fits properly.
To use this new dialog you also need to add another wxs file and you can call it AppName_InstallDir.wxs which will be a copy of this https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/WixUI_InstallDir.wxs . Here you need to change the <UI> Id to AppName_InstallDir
Just change the <DialogRef Id="BrowseDlg"> to <DialogRef Id="AppNameBrowseDlg">
You'll also need to modify these lines
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
to reference your AppNameBrowseDlg
This essentially replicates the dialog and UI definition that you were using in your installer. In your Product, you just need to change the UIRef to be "AppName_InstallDir" and it will use your defined UI that replaced the default browsedlg with one that can hopefully fit the Danish text. I would also consider submitting a wix improvement here https://github.com/wixtoolset/issues/issues asking that the WixUI's browsedlg's description control is wider.
For your Launch text you're getting stuck with english because you are using the English msi as a base for the other languages. The way this checkbox has been implemented means you are hardcoding the english text from the property that the checkbox control's text value is set to. The way you are localizing the msi is probably creating multiple strings tables and selecting strings from the appropriate table at runtime. But, the checkbox doesn't get its text value from the strings table. Instead, it is from the value of a property which was set at to be the value of "LaunchApp". (Incidentally, if you used the Danish version of the msi as a base, this text would always be Danish).
We can fix this in much the same way we modified the Wix BrowseDlg. In this case we want to copy over the ExitDialog to AppNameExitDialog.wxs from here https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/ExitDialog.wxs
You will need to rename the Dialog Id to AppNameExitDialog and then we want to look at this control
<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Hidden="yes" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="[WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT]">
<Condition Action="show">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT AND NOT Installed</Condition>
</Control>
you want to change it to the following
<Control Id="OptionalCheckBox" Type="CheckBox" X="135" Y="190" Width="220" Height="40" Property="WIXUI_EXITDIALOGOPTIONALCHECKBOX" CheckBoxValue="1" Text="!(loc.LaunchApp)" />
Additionally, windows installer is unable to display the background of a checkbox automatically as any other color than the grey-ish one you see in the screenshot you linked. If you want to get rid of this grey behind the text, you can actually modify the checkbox control's width and height to be about the size of the checkbox itself and set the text to "". Then you need to add another Text control to the UI that goes where the Check box's text used to go. This way you would have not have any grey background behind the text. The downside of this is that you must click the actual checkbox to toggle whether it is checked or not whereas before you could click anywhere in the grey area.
Again, to properly reference this new dialog you need to go to your AppName_InstallDir.wxs file and change the ExitDialog references to instead be AppNameExitDlg and also change the one <Publish> referencing the ExitDialog.
Hope this helps. The git repository is very useful for understanding how wix really works under the hood.
Upvotes: 1