在”Catalog Item View”中选择支持MUI的组件,选择”Core
OS”->”CEBASE”->”International”->”Multilingual User Interface(MUI)”
选择菜单的Platform->Setting…,在弹出的对话框中的Custom Build Actions页的下拉框中选择Pre-Make Image
2.点击New…加入语句createmui XXXX,此处的XXXX表示要支持切换的语言,例如: createmui 0409,0804,0404
此处0409为英语(美国),0804为简体中文,0404为繁体中文。以“,”分隔。
运行成功后会生成一个MultiUI.bib文件,打开该文件,拷贝所有内容到common.bib文件的末尾。MutiUI.bib文件中可能包含k.coredll.dll.xxx,在common.bib文件中删除所有的k.coredll.dll.xxx项。
3.在platform.bib中添加如下语句:
#include $(_FLATRELEASEDIR)/MultiUI.bib
4.重新编译(Build and Sysgen Current BSP)。
WINCE6 同时支持简繁体
最近两星期在玩WINCE6,因产品需要,应用软件需支持简繁体,显示其中一种很好办,只需要加入相应的字库。如加入简体字库: CEBASE->International->Locale Specific
Support->Chinese(Simplified),选择字库SimSun & NSimSun(Subset 2_50),通常情况选择这个就够了,而SimSun & NSimSun这个太大,有10M左右,并把GB18030 Data Converter及Monotype Imaging AC3 Font Compression(对字体进行压缩,减小NK大小)勾上。编译烧入,简体字都能正常显示,但繁体字显示的就为框框,原因是没有添加繁体字库。
增加繁体字库:
CEBASE->International->Locale Specific
Support->Chinese(Traditional),选择MingLiU & PMingLiU(Subset 2_70),并把Monotype Imaging AC3 Font Compression勾上。编译烧入,繁体字也能正常显示。至此以为大功告成,问题出来了,发现简体字又不能正常显示,这就纳闷了,明明将简体字库添加到系统了,为啥不能显示呢?。。。。。
将繁体字库去掉,简体字又能显示出来,初步认为是注册表哪个地方有覆盖,最后发现工程下的Common.reg有疑问:
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/FontLink/SystemLink] "Tahoma"="//Windows//simsun.ac3,NSimSun"
"Courier New"="//Windows//simsun.ac3,NSimSun" "Arial"="//Windows//simsun.ac3,NSimSun"
"Times New Roman"="//Windows//simsun.ac3,NSimSun" "Symbol"="//Windows//simsun.ac3,NSimSun"
; @CESYSGEN ENDIF FONTS_AC3_VERSIONS
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/FontLink/SkipTable] "Tahoma"="005c,00a5,007e,0391-03c9,2026,2116,221a,25a0-25ff"
"Arial"="005c"
"Courier New"="005c"
; @CESYSGEN ENDIF FONTS_SIMSUN
; @CESYSGEN IF FONTS_MINGLIU || FONTS_MINGLIU_2_70 || FONTS_MINGLIU_2_80 || FONTS_MINGLIU_2_90
[HKEY_LOCAL_MACHINE/SYSTEM/GDI]
"FontLinkMethods"=dword:1
; @CESYSGEN IF !FONTS_AC3_VERSIONS
; @CESYSGEN ENDIF !FONTS_AC3_VERSIONS
; @CESYSGEN IF FONTS_AC3_VERSIONS
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/FontLink/SystemLink] "Tahoma"="//Windows//mingliu.ac3,PMingLiU"
"Courier New"="//Windows//mingliu.ac3,PMingLiU" "Arial"="//Windows//mingliu.ac3,PMingLiU"
"Times New Roman"="//Windows//mingliu.ac3,PMingLiU" "Symbol"="//Windows//mingliu.ac3,PMingLiU"
; @CESYSGEN ENDIF FONTS_AC3_VERSIONS
注意红色 标出的两个地方,
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/FontLink/SystemLink] 键名是相同的,前面是简体字库,后面是繁体字库,这下就可以肯定后面的注册表会将前面的覆盖。汗……,难道是MS的BUG? 最后在PB帮助文档上也看到
If your run-time image includes more than one East Asian locale, you must modify the values under the SystemLink r
egistry key in common.reg to include the font
files for all of your targeted locales. You must list all of the font files by using a semi-colon separator as shown in the following example:
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/FontLink/SystemLink]
"Arial"="//Windows//simsun.ttc,NSimSun;//Windows//msgothic.ttc,MS UI Gothic"
"Times New Roman"="//Windows//simsun.ttc,NSimSun;//Windows//msgothic.ttc,MS UI Gothic"
"Tahoma"="//Windows//simsun.ttc,NSimSun;//Windows//msgothic.ttc,MS UI Gothic"
"Courier New"="//Windows//simsun.ttc,NSimSun;//Windows//msgothic.ttc,MS UI Gothic"
"Symbol"="//Windows//simsun.ttc,NSimSun;//Windows//msgothic.ttc,MS UI Gothic"
清楚问题原因就好办了,将注册表改成
[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/FontLink/SystemLink]
"Tahoma"="//Windows//simsun.ac3,NSimSun;//Windows//mingliu.ac3,PMingLiU"
//用分号;分隔符隔开再添加繁体字库的路径信息,当时我一直以为是要去增加image的大小,没找到//原因 2010.10.12 ylh++
"Courier
New"="//Windows//simsun.ac3,NSimSun;//Windows//mingliu.ac3,PMingLiU"
"Arial"="//Windows//simsun.ac3,NSimSun;//Windows//mingliu.ac3,PMingLiU"
"Times New
Roman"="//Windows//simsun.ac3,NSimSun;//Windows//mingliu.ac3,PMingLiU"
"Symbol"="//Windows//simsun.ac3,NSimSun;//Windows//mingliu.ac3,PMingLiU"
第二篇:C#多语言支持
C# 多语言
C#多语言支持的一个简单示例,步骤很简单
1、为每种语言创建资源文件,资源文件名类似:类名.语言.resx 如 Form1.zh-CHS.resx 为中文的资源文件
Form1.en.resx 为英文的资源文件
Form1.en.resx内容:
Form1.zh-CHS.resx内容
2、引入命名空间
using System.Resources;
using System.Threading;
3、 声明资源管理变量
ResourceManager rm;
4、让程序在启动时自动选择语言类型
updateUI()函数如下:
Btn_message :消息按钮控件名称, “btn_message”为资源文件中的字段名称 MenuItem_Language :菜单项名称
MenuItem_Chinese :子菜单项名称
MenuItem_English :子菜单项名称
5、程序启动后自由切换语言,比如选择英文,对应处理函数如下
6、某些固定的消息文本也可以做多语言显示
在资源文件中预先定义好要显示的消息文本,在弹出消息,根据当前语言弹出对应的消息。 如示例中消息按下后:
7、附:示例全部代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Resources;//资源管理
using System.Threading;//线程
namespace multiLanguage
{
public partial class Form1 : Form
{
ResourceManager rm;//声明资源管理变量
public Form1()
{
InitializeComponent();
changeLanguage();//根据系统语言更改界面文字
}
//消息button
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(rm.GetString("str_message"), this.Text);
}
private void changeLanguage()
{
rm=new ResourceManager(typeof(Form1));
if (System.Globalization.CultureInfo.InstalledUICulture.Name.Substring(0, 2) == "zh")
{
Thread.CurrentThread.CurrentUICulture=
new System.Globalization.CultureInfo("zh-CHS");
rm = new ResourceManager(typeof(Form1));
}
if (System.Globalization.CultureInfo.InstalledUICulture.Name.Substring(0, 2) == "en")
{
Thread.CurrentThread.CurrentUICulture=
new System.Globalization.CultureInfo("en");
rm = new ResourceManager(typeof(Form1));
}
updateUI();
}
//刷新界面文本
private void updateUI()
{
btn_message.Text = rm.GetString("btn_message");
MenuItem_Chinese.Text = rm.GetString("MenuItem_Chinese");
MenuItem_English.Text = rm.GetString("MenuItem_English");
this.Text = rm.GetString("formcaption");
MenuItem_Language.Text = rm.GetString("MenuItem_Language");
}
private void chineseToolStripMenuItem_Click(object sender, EventArgs e) {
Thread.CurrentThread.CurrentUICulture=
new System.Globalization.CultureInfo("zh-CHS");
ResourceManager rm = new ResourceManager(typeof(Form1));
updateUI();
}
private void englishToolStripMenuItem_Click(object sender, EventArgs e) {
Thread.CurrentThread.CurrentUICulture=
new System.Globalization.CultureInfo("en");
ResourceManager rm = new ResourceManager(typeof(Form1));
updateUI();
}
}
}