国际化组件的设计
1.1.1 国际化组件
Author |
Contact |
Jin-Chen Zhu,LangChao |
zhujch@langchao.com |
1.1.1.1 Goal
国际化组件可以将非特定语言的字符串转化成特定语言的字符串,还可以通过反射的方式将某一界面上控件的文字换成特定语言的文字。
1.1.1.2 Context
1.1.1.3 Behavior View
1.1.1.4 Structure View
1.1.1.5 Other Specification
1.1.1.6 Best Practice
ResourceFactory fa = ResourceFactory.GetInstance();
GspRM resourceManager = null;
if (comboBox1.Text == "中文")
{
resourceManager = fa.GetRM("formui", "zh-cn");
//resourceManager = fa.GetRM("aa","zh-cn");
FormLanguageSwitchSingleton change = FormLanguageSwitchSingleton.Instance;
change.ChangeLanguage(this, new System.Globalization.CultureInfo("zh-chs"));
}
else
{
resourceManager = fa.GetRM("formui", "en-us");
FormLanguageSwitchSingleton change = FormLanguageSwitchSingleton.Instance;
change.ChangeLanguage(this, new System.Globalization.CultureInfo("en-us"));
}
MessageBox.Show(resourceManager.GetLocalizeToken("result", "jane"));