jaybeeuu
jaybeeuu

Reputation: 1123

Localizable text in a Custom WIX UI Library

I have 2 projects:

  1. InstallerUILibrary.wixlib - contains a custom WIX dialog and UI fragment so i can reuse it and the localizable text the dialog uses.
  2. SomeInstaller.wixproj - an installer project which references InstallerUILibrary.wixlib which uses the UI in it's installer product.

I have localised the text in InstallerUILibrary.wixlib with entries like this:

<Control Id="DiskCost" Text="!(loc.InstallDirDiskCostDlgDiskCost)">

And included en-us.wxl in InstallerUILibrary.wixlib which looks something like this:

<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
    <String Id="InstallDirDiskCostDlgDiskCost">Disk Cost...</String>
</WixLocalization>

SomeInstaller however fails to see the wxl file and therefore does not build as the localisable text is broken.

Is this expected? Have a I made some boo boo in referencing my project files? Is there some switch somewhere which will make it all work?

Do i have to include en-us.wxl in each of the consuming project?

Upvotes: 0

Views: 621

Answers (1)

jaybeeuu
jaybeeuu

Reputation: 1123

Empirically I have discovered that you need to add at least one localisation file to your installer project. This doesn't need to include any strings, just the WixLocalization element.

If you don't have any .wxl files then the "Cultures to build" text box will be read only. But once you add one this appears to prompt Votive to get it's act together and apply some localisation you asked for.

Then what you can do is "suggest" that it build an invariant culture version of the installer falling back on your chosen language. by adding this

neutral,en-us;

To the Cultures to build text box in the project properties which should now be editable.

So in summary my solutions loom like this:

  • InstallerUILibrary.wixproj - wixlib

    • Localization
      • customDlg_en-US.wxl - Contains the strings used in CustomDlg.wxs Culture="en-US".
    • customDlg.wxs
  • SomeInstaller.wixproj - Installer - Cultures to build set to neutral,en-US;

    • Localization
      • invariantCulture.wxl - Contains a single empty WixLocalisationElement with Culture = "" (empty string)
    • Product.wxs - references CustomDlg

If anyone has a neater solution that would be wonderful.

Some reading I found only mildly useful:

Upvotes: 2

Related Questions