![]() |
WiX Localization and Internationalization |
WiX Toolset (Wikipedia) builds Windows Installer packages (.msi) from XML source files. WiX stores the strings of an installer in WiX localization files (.wxl), one file for each language. Soluling Desktop and Soluling Cloud support WiX localization files and WiX project files.
The end of the document contains links to get the full source code of the samples. After reading this document, we recommend reading a tutorial about how to use Soluling.
Move the strings of your WiX source file (.wxs) into a WiX localization file and refer to them with !(loc.Id). Here is the Product.wxs file of the Driving sample.
<Product Id="*" Name="!(loc.ProductName)" Language="!(loc.LocaleId)" Version="1.0.0.0" Manufacturer="Soluling" UpgradeCode="021318e6-4cbe-46f5-be37-80ace1a74fe1"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" SummaryCodepage="!(loc.SummaryCodepage)" /> <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" /> <Feature Id="ProductFeature" Title="!(loc.ProductTitle)" Level="1"> ...
The strings are in the original localization file, en-US.wxl.
<WixLocalization Culture="en-US" xmlns="http://schemas.microsoft.com/wix/2006/localization"> <String Id="ProductName"><!-- Product name -->Driving</String> <String Id="ProductTitle"><!-- _locComment="Product title" -->Driving</String> <String Id="DowngradeErrorMessage"><!-- Comment=[ProductName] is a placeholder for product name -->A newer version of [ProductName] is already installed.</String> <String Id="LocaleId">1033</String> <String Id="SummaryCodepage">1252</String> <String Id="CodeValue" Localizable="no">123</String> </WixLocalization>
Soluling handles the strings as follows:
[ProductName] is a Windows Installer property. Keep it as it is in the translation.LocaleId and SummaryCodepage are not translated. When building, Soluling writes the locale ID (LCID) and the code page of the target language into them. For Finnish, they are 1035 and 1252. Use them in the Language attribute of Product and the SummaryCodepage attribute of Package. You can change the names of these strings on the Options sheet.Localizable="no".WiX 4 and later can store the string in a Value attribute, <String Id="ProductName" Value="Driving" />. Soluling supports both forms.
You can localize a WiX installer in two ways:
.wixproj). Soluling reads the localization files that the project file contains as EmbeddedResource items. The original language is the culture of the files, for example, en-US.wxl or Strings_en-US.wxl. Use this with WiX 3 projects..wxl). You add the original localization file to the Soluling project. Use this with SDK-style WiX 4 and later projects, which include the localization files automatically, and when you do not use a project file.In both cases, Soluling creates the localized localization files next to the original file. It uses the <body>_<id>.<ext> pattern, so en-US.wxl becomes fi.wxl and Strings_en-US.wxl becomes Strings_fi.wxl. Soluling sets the Culture attribute of the localized file to the culture of the target language. If the target language does not have a country, such as Finnish (fi), Soluling uses the default country (fi-FI), because the WiX UI extension contains its dialog strings only for cultures with a country.
<WixLocalization Culture="fi-FI" xmlns="http://schemas.microsoft.com/wix/2006/localization"> <String Id="ProductName"><!-- Product name -->Ajoaika</String> <String Id="ProductTitle"><!-- _locComment="Product title" -->Ajoaika</String> <String Id="DowngradeErrorMessage"><!-- Comment=[ProductName] is a placeholder for product name -->[ProductName]:n uudempi versio on jo asennettu.</String> <String Id="LocaleId">1035</String> <String Id="SummaryCodepage">1252</String> <String Id="CodeValue" Localizable="no">123</String> </WixLocalization>
WiX has no standard way to attach a comment to a string. Soluling lets you give the translator more information by adding an XML comment inside the String element, before or after the value. Soluling shows the comment in the translation grid.
<String Id="hello"><!-- This is a comment -->Hello World</String> <String Id="hello">Hello World<!-- This is a comment --></String>
The comment can also start with Comment=, or it can contain a _locComment attribute, like the comments in the WiX UI extension. Soluling takes only the comment text.
<String Id="hello"><!-- Comment=This is a comment -->Hello World</String> <String Id="hello"><!-- _locComment="This is a comment" -->Hello World</String>
Add the localized localization files to your WiX project. In a WiX 3 project, add them as EmbeddedResource items. If a localized file is missing from the project file, Soluling tells you to add it.
<ItemGroup> <EmbeddedResource Include="en-US.wxl" /> <EmbeddedResource Include="fi.wxl" /> </ItemGroup>
Build the project in Visual Studio or with MSBuild. WiX builds one installer for each culture, for example, bin\Debug\en-US\Driving.msi and bin\Debug\fi-FI\Driving.msi. To build only some cultures, set the Cultures property of the project, for example, <Cultures>en-US;fi-FI</Cultures>.
Driving.wixproj) or the original localization file (e.g., en-US.wxl) on Soluling or click the New from File or Files button and select the file.fi.wxl.When you change the original localization file, open the Soluling project and choose Home | Scan. Soluling keeps the existing translations, and you only translate the strings that were added or changed.
With Soluling Cloud, you localize the original localization file in your browser: upload the file, translate it in Translate, and download the localized files. You need a Soluling account. See the available Cloud plans.
If you want to use the WiX project file, create the project in Soluling Desktop first and upload the project. See WiX project files.
en-US.wxl), or drag and drop the file onto the page. Click Create.Click the project's green Translate button on the dashboard. Translate opens the project, and you can type the translations into the grid. Machine translation suggestions, translation memory, and spell checking are available there. You do not have to finish every language before moving on to the next step.
fi.wxl.When you change the strings, upload the new original file, translate what is new or changed, and download the localized files again. On the dashboard, click the project's Update file button (the upload arrow), select the new file or drop it onto the page, and click Update. Existing translations are kept, so you only translate the strings that were added or changed.
The dashboard is one of four ways to use Soluling Cloud. You can also use the SoluCLI command-line tool, Soluling Desktop, or SoluMake, which can run the update and build steps in your build pipeline. See the Cloud tutorial for all of them.
A WiX project file refers to other files, so you create the project in Soluling Desktop, upload it to Soluling Cloud, and build the localized files in Soluling Desktop.
.wixproj file in Soluling Desktop as described in Desktop process, and save it. This creates the Soluling project file (.ntp).When the strings change, in Soluling Desktop, on the Home tab, click Scan. On the Translate tab, click Upload to Cloud. The cloud project is updated to match your local one, and translations that exist only in the cloud so far are kept. Translate the new and changed strings, then Import from Cloud and build again.
GitHub and <data-dir>\Samples\Wix contain the following WiX sample directories:
| Directory | Description | Notes |
|---|---|---|
| Driving | A WiX 3 installer whose strings are in en-US.wxl. The localization file contains comments, a placeholder, the locale ID and code page strings, and a string that is not localizable. The directory contains two Soluling projects: Driving.ntp localizes the WiX project file, and en-US.ntp localizes the localization file. Both create the Finnish fi.wxl. | Try this first! |
| FinnishSample | A WiX 3 installer that is built for Finnish only (Language="1035" and <Cultures>fi-FI</Cultures>). It shows the Finnish dialogs of the WiX UI extension. |
No Soluling project |
The installers contain the Localized.exe file of the Delphi VCL Driving sample. Build that sample before you build the installers.
You create a WiX project file localization project by adding a WiX project file (e.g., D:\Sample\Sample.wixproj) into your Soluling project. You can configure how to localize your WiX project file
by selecting the item in the project tree, right-clicking, and choosing the Options menu. A source dialog appears that lets you edit the options. This source uses the following option sheets.
You create a WiX localization file localization project by adding a WiX localization file (e.g., D:\Sample\en-US.wxl) into your Soluling project. You can configure how to localize your WiX localization file
by selecting the item in the project tree, right-clicking, and choosing the Options menu. A source dialog appears that lets you edit the options. This source uses the following option sheets.