Monday 17 August 2015

Multilingual support in MSI, using ORCA tool.


I am writing this into a blog because, as usual this took a lot of time for me to get through. I am new to MSI, and started with the ORCA tool to edit it. Not one of the good tools to start with, as said on the web. I think understanding ORCA takes some time, but once you understand, you know the very basics of MSI.
Below i have discussed, how one can create MSI installers in languages that are not supported in visual studio by default.

------------------------------------------------------------------------------------------------
L O C A L I Z A T I O N
------------------------------------------------------------------------------------------------

What do i mean by localization of MSI

By default the MSI installer project in visual studio, builds the project in english. That is, all the strings displayed on the UI(User Interface) of the installer are in english language (English U.S.).

The term localization refers to the language used in the UI should be in the local language of the customer, or to be more precise, it should be in the same language as his operating system.
Example: If a arabic build of windows is installed, the strings in the UI should be in arabic. The people in france will see the strings in french. This adds more value to the product, in terms of ease in use.

The image is the snapshot of visual studio, that shows the localization setting in visual studio.
Actually visual studio itself supports some languages apart from english.

The Following is the list of languages supported by visual studio for a deployment project, i.e. msi project.



Lets get known to some tools that are used while creating a msi.

------------------------------------------------------------------------------------------------
T O O L S
------------------------------------------------------------------------------------------------

The ORCA tool:

ORCA is a very basic, but a usefull tool to edit the MSI tables. Almost all the information in the MSI is displayed in ORCA, in form of tables, Each table is described on MSDN, in detail over here.
Example: The file table lists all the files that are packaged in the MSI installer.
When the project is built, the default language is english.

MSI Language:

The ORCA tool can be used to edit the strings in the MSI installer. The Property table contains a row named ProductLanguage, that tells the language for which the MSI was built.

Code Page:
The code page setting is not shown in the ORCA tables, instead it is present in the menu bar. To change the code page of the current MSI file,

Tools->Code Page...
Set the new code page in the New Code Page text box.

Note:

1. If the code page of the installer is not changed, some unreadable characters will get displayed on the UI.
2. Each language requires its own transform file, generated from the MSI of the code page for that language
Eg: Transform file generated from language L, cannot be applied on MSI of any language, other than L.

wilangid.vbs

This script can be used to change the current language and the code page of the MSI file
More Info: https://msdn.microsoft.com/en-us/library/aa369791(v=vs.85).aspx

msitrans.exe

This tool can be used to apply the transform file generated from the ORCA tool.
More Info: https://msdn.microsoft.com/en-us/library/aa370495(v=vs.85).aspx

------------------------------------------------------------------------------------------------
A L G O R I T H M
------------------------------------------------------------------------------------------------

Create a MSI with localization value set to neutral.
For each a language ‘L’,
Change the code page of the MSI to CodePage(L), using orca/wilangid.vbs
Change the language of the MSI to language L, using orca/wilangid.vbs
Open the MSI in orca tool
Do the necessary string localization related changes,
Generate the base transform file T(L)

------------------------------------------------------------------------------------------------
A U T O M A T I O N
------------------------------------------------------------------------------------------------

Once the base transform files are created for each language.
Following steps can be used to create a MSI for language L.
Create a MSI with localization set to neutral.
Change the codepage using wilangid.vbs script.
Change the language to L using wilangid.vbs script.
Modify the transform file for L, if required.
Apply the T(L) on MSI

All of this process can be easily automated.

------------------------------------------------------------------------------------------------


Keep Exploring.. :)

No comments:

Post a Comment