首页 > 其他分享 >Wix Setting language and code page attributes

Wix Setting language and code page attributes

时间:2022-12-27 09:58:53浏览次数:38  
标签:code language Awesome supported Setting characters page

When you localize your MSI package, you'll need to alter your Productand Package elements to suit. To do so, you'll leverage code pages and locale identifiers (LCIDs). So the first thing to do is define what we mean by these terms.
Alocale identifieris an ID used to classify a particular language and the region where it's spoken. It serves the same purpose as an IETF language tag, such as "en-us", but is formatted as a number. For example, "1033" means English as spoken in the United States. A full chart of LCIDs can be found at Microsoft's MSDN web site by searching for locale ID. The URL is:
http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx
Although that page also provides LCIDs in hexadecimal form, you should always use the decimal form in WiX.
A code pageis an add-on of extra printable characters that aren't covered in the basic set of 128 ASCII characters. I might as well break the news that WiX does not use Unicode. It has to do with the fact that Windows Installer itself doesn't have strong support for Unicode. For most tasks, this shouldn't present much of a problem. ASCII covers all of the English alphabet and common punctuation marks. You can see a chart displaying ASCII at:
http://msdn.microsoft.com/en-us/library/60ecse8t%28VS.80%29.aspx
However, it doesn't cover non-Latin characters (such as Chinese) or characters with accents over them such as those found in French and Spanish. So, to print the accents marks over Spanish letters, you'll need a code page. Without it, your installer won't know how to render the characters you want. A full list of code pages can be found at Microsoft's MSDN website:

http://msdn.microsoft.com/en-us/library/dd317756
As an example, you could specify a code page of "950" to make Traditional Chinese characters available. In the following sections, we'll see how the Productand Packageelements make use of LCIDs and code pages.
The Package element
First, let's look at the Packageelement. Its job is to sum up details about the installer such as who the author is and what platform it supports. Another important piece of information it publishes is the language that's supported. An MSI package only lists one supported language and it does so by setting the Packageelement's Languagesattribute. The attribute name is plural because the Packageelement is also used in merge modules and they can list multiple supported languages. Here's an example that sets the supported language to 1033(English - United States):
<Package Compressed="yes"
InstallerVersion="301"
Manufacturer="Awesome Company"
Description="Installs Awesome Software"
Languages="1033" />
When the end user launches the installer, their computer looks to the Packageelement to find out what the supported language is. If that language isn't installed locally, an error will be displayed telling the user so.

Here's a message I got when I tried to install an MSI package that specified an LCID of 1085, Yiddish, as the supported language:
Also, if your own development computer doesn't have that language installed, an exception will be thrown when you try to build the WiX project, as shown in the following screenshot:
Windows Installer stores the supported language in something called the Template Summaryproperty. You can find more information about it at the following website:
http://msdn.microsoft.com/en-us/library/Aa372070
Open your MSI with Orca and select View| Summary Informationto see it. It will be listed as the Platformand Languagesfields.
Getting back to the Languagesattribute on the Packageelement, you have the option of using a localization variable instead of a hardcoded value, as in the following example:
<Package Compressed="yes"
InstallerVersion="301"
Manufacturer="Awesome Company"
Description="Installs Awesome Software"
Languages="!(loc.LocaleId)" />
Here, we've specified the variable !(loc.LocaleId)for the Languagesattribute. The value for this variable will be filled in by a WiX localization file (.wxl). Here's a sample .wxlfile that defines this variable for Spanish localization:
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="es-es" Codepage="1252"
xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="LocaleId">1034</String>

<!--Other strings defined here-->
</WixLocalization>
The Packageelement has another attribute called SummaryCodepagethat's used to set the code page for the summary properties. Summary properties are the details shown when you right-click on an MSI file and view its Properties. If any of these use characters outside of the ASCII set, they'll need a code page to display them.
You could set a hardcoded value, as in this example:
<Package Compressed="yes"
InstallerVersion="301"
Manufacturer="Awesome Company"
Description="Installs Awesome Software"
Languages="!(loc.LocaleId)"
SummaryCodepage="1252" />

Here we've specified that the code page to use is 1252, which is the code page containing additional Latin character such as the copyright symbol and characters with accents. If you don't specify the SummaryCodepageattribute it defaults to 1252. You might explicitly set this attribute if you use extended characters such as those for Chinese. If we had used Chinese characters in, for example, theDescriptionattribute, we would have had to specify a code page such as 950
You can also use a localization variable like this:
<Package Compressed="yes"
InstallerVersion="301"
Platform="x86"
Manufacturer="Awesome Company"
Description="Installs Awesome Software"
Languages="!(loc.LocaleId)"
SummaryCodepage="!(loc.SummaryCodepage)" />

标签:code,language,Awesome,supported,Setting,characters,page
From: https://www.cnblogs.com/CS-ComputerScience/p/17007385.html

相关文章

  • macOS下vscode配置c++万能头文件
    vscode正常情况下是不能使用c++的万能头文件#include<bits/stdc++.h>,那么这会给我们算法刷题带来一定的不便,以下是配置教程,具体可以参考该博文:macOS下使用bits/stdc++.h万......
  • leetcode-541. 反转字符串 II
    541.反转字符串II-力扣(Leetcode)比较简单,想清楚边界条件,然后做一下字符的反转即可。go可以将不能变动的字符串转换成可以变动的[]byte之后,修改完之后,再转成string......
  • Atcoder Beginner Contest ABC 283 Ex Popcount Sum 题解 (类欧几里得算法)
    题目链接令\(p=\lfloor\frac{n-r}m\rfloor\),则我们其实是要对所有\(0\lei\le29\)求\(\sum_{j=0}^p(\lfloor\frac{mj+r}{2^i}\rfloormod\2)\)。右边那个东西如果没......
  • AtCoder Grand Contest 060(持续更新)
    Preface那一天,闪总终于想起了被ACG支配的恐惧……只能说还好Rating不够,这场Unrated打的,写了个A然后B一直挂(一个细节没想到),C数数又数不来90min后光速跑路推Gal去了A-......
  • C语言开发环境搭建:VSCode+GCC
    文章目录​​一.VSCode介绍​​​​二.GCC编译器​​​​1.安装​​​​三.VScode中配置GCC​​一.VSCode介绍VSCode(全称:VisualStudioCode)是一款由微软开发且跨平台......
  • Codeforces Global Round 14 C. Phoenix and Towers(思维)
    https://codeforces.com/contest/1515/problem/C题目大意:给定一个长度为n的序列a,ai表示方块的高度。每一个方块的高度都在1和q之间。让我们用这n个方块搭建m座塔,两两......
  • Codeforces Round #768 (Div. 2)C ,D
    CodeforcesRound#768(Div.2)C,DCC这一道题的大意是从0到n-1,(n一定是2的x次方),我需要找n/2对数对,使得每一个数对(x,y),x&y的和要等于k(k<=n-1)我一开始是没什么思路的,......
  • #yyds干货盘点# LeetCode程序员面试金典:二叉搜索树序列
    题目:从左向右遍历一个数组,通过不断将其中的元素插入树中可以逐步地生成一棵二叉搜索树。给定一个由不同节点组成的二叉搜索树 root,输出所有可能生成此树的数组。 示例1:......
  • #yyds干货盘点# LeetCode程序员面试金典:检查子树
    题目:检查子树。你有两棵非常大的二叉树:T1,有几万个节点;T2,有几万个节点。设计一个算法,判断T2是否为T1的子树。如果T1有这么一个节点n,其子树与T2一模一样,则T2为T1......
  • leetcode-17. 电话号码的字母组合
    17.电话号码的字母组合给定一个仅包含数字2-9的字符串,返回所有它能表示的字母组合。答案可以按任意顺序返回。给出数字到字母的映射如下(与电话按键相同)。注意1不对应......