UI Menu:
1、窗体资源文件,控件UI布局完成。
2、设置窗体Localization为True。
3、设置窗体Language为中文。
4、设置各个窗体控件的中文名称保存。
5、窗体文件下面就会产生窗体.zh.resx的文件。
Dialog:
1、增加项目资源文件.resx.
2、增加strText新字符变量。
3、对话框等名称直接通过ResouseManger,反射实例查找对应字符串 strText.
4、重复步骤2-3,完成本地化保存.resx。
5、可以复制.resx为.zh.resx等需要翻译的文本,更新文本保存成对应的文本即可。
步骤:
1、InitialComponent前,加载 UICulture设置:
public Form1()
{
// C#
// Sets the UI culture to French (France).
language = File.ReadAllLines("Config.txt")[0];
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
comboBox1.Text = language;
}
2、Dialgo 反射
ResourceManager LocRM = new ResourceManager("Namspace.ResourceNameWithoutExtension", typeof(Form1).Assembly);
// Assign the string for the "strMessage" key to a message box.
MessageBox.Show(LocRM.GetString("strMessage"));
1、窗体资源文件,控件UI布局完成。
2、设置窗体Localization为True。
3、设置窗体Language为中文。
4、设置各个窗体控件的中文名称保存。
5、窗体文件下面就会产生窗体.zh.resx的文件。
6、复制后修改为其他需要配置的语言文字,并命名相应后缀,如:.en-US.resx。
Dialog:
1、增加项目资源文件.resx.
2、增加strText新字符变量。
3、对话框等名称直接通过ResouseManger,反射实例查找对应字符串 strText.
4、重复步骤2-3,完成本地化保存.resx。
5、可以复制.resx为.zh.resx等需要翻译的文本,更新文本保存成对应的文本即可。
步骤:
1、InitialComponent前,加载 UICulture设置:
public Form1()
{
// C#
// Sets the UI culture to French (France).
language = File.ReadAllLines("Config.txt")[0];
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
//Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh");
comboBox1.Text = language;
}
2、Dialgo 反射
ResourceManager LocRM = new ResourceManager("Namspace.ResourceNameWithoutExtension", typeof(Form1).Assembly);
// Assign the string for the "strMessage" key to a message box.
MessageBox.Show(LocRM.GetString("strMessage"));