0

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 .Cut off built in text

what is the problem here and how to fix it ? launch is always in English 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 -->
Cœur
  • 37,241
  • 25
  • 195
  • 267
Laila
  • 549
  • 1
  • 13
  • 30

1 Answers1

1

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.

Brian Sutherland
  • 4,698
  • 14
  • 16
  • I had added a part of .wxs file that contains the UI of the installer – Laila Apr 19 '16 at 08:47
  • I made search on how to change the size of UI but i found nothing !! Do you mean i have to add custome dialogs ? – Laila Apr 19 '16 at 09:15
  • Updated the answer with an update below the horizontal rule. Hope this helps =] – Brian Sutherland Apr 19 '16 at 19:34
  • Thank you very much :) ,, i will try this and will get back to you :D – Laila Apr 20 '16 at 09:05
  • I tried your suggested solution but and now i can build and get one .msi for danish and another one for english ,, but now i have a problem that after i override the UI of wix as you said i am not able to get one multilangual .msi file by applying the command wisubstg.vbs ... i used to use it to get only one file for both languages ,now when i run the command on .msi file and start to install it , there is an error with code 2881. – Laila Apr 21 '16 at 07:13
  • wisubstg.vbs WiLangId.vbs this two are my scripts to run da-DK.mst on the .msi file to make it myultilangual – Laila Apr 21 '16 at 09:02
  • Unfortunately I don't know much about those vbs scripts. I would check that the installers themselves can run properly (just the english one and just the danish one). If they work that's good. I would also try to modify the UI incrementally. First copy over the WixUI_InstallDir.wxs file and change the UI Id and your UIRef Id without changing anything else to see if you can still build and use the vbs scripts. Repeat after replacing BrowseDlg and the references to it in the InstallDir.wxs. See if the build and vbs scripts work. Then try the ExitDlg. Probably one reference is off ? – Brian Sutherland Apr 21 '16 at 20:39
  • I had checked the insatllers themseleves the english one and the danish one and they are working fine but after running the script on the englidh one to make it run on both languages , the script run fine but when i double click the .msi that resulted it gives an error with code 2881 .... and i had tried what you wrote above to change the UI incrementally and i guess when i try to override any UI the scripts do not create a correct result . actually i think the scripts works only on the built in UI ,, but still not sure – Laila Apr 22 '16 at 08:17