移动应用语言资源文件 [英] Mobile Application Language resource file

查看:103
本文介绍了移动应用语言资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我开发了Windows Mobile应用程序(6.0),并使用了两种资源文件(两种语言).我在加载每种表单时都加载了资源文件,而当表单中有很多标签或文本框时,加载该文件会花费一些时间.

这是我用来设置语言的函数,在表单加载时调用它.

Hello all,

Im developing a windows mobile application(6.0) and im using two resource files,for two languages. I load the resource file on load of each form,and it takes a little time to load,when the forms have a lot of labels,or textboxes.

this is the function i use to set the language,and i call it when form loads.

public static void ChangeLanguage(Form forma)
       {
           foreach (Control c in forma.Controls)
           {
               ComponentResourceManager resources = new ComponentResourceManager(forma.GetType());
               resources.ApplyResources(c, c.Name, new CultureInfo(glob_lang));
           }
       }



还有其他方法可以做到这一点,例如,以主要形式(针对所有应用程序)设置语言,而其他形式则不再需要调用该函数了?



Is there any other way to do this,for example set the language in the main form(for all application),and the other forms dont need to call the function anymore?

Thanx in advance!

推荐答案

将其添加到入口点(Main,通常在Program.cs中,静态void Main()):
Add this to entry point(Main, usually in Program.cs, static void Main()):
Thread.CurrentThread.CurrentCulture = new CultureInfo(glob_lang); 



也可以尝试本地化:
.NET-使用资源文件进行本地化 [



Also try Localisation :
.NET - Localization using Resource file[^]


这篇关于移动应用语言资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆