100分求一全球化应用程序解决方案!!!!! 我现在要做一个项目,客户要求有中文和英文版本。.net 里的全球化好像是可以实现这种功能,我也在网上查了一些资料,大部分的资料都是说利用扩展名为resx文件来实现本地化,但我们现在是用VS2005开发,VS2005里面已经没有resx文件了。请问各位在2005里面该怎么实现。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你看看Form中的Localizable属性,将它设为true在Form的目录下就会有一个Form1.resx的文件 把窗体前面的加号点开,就可以看到.resx文件了 VS2005里面已经没有resx文件了=================================谁跟你说没有了???还有你的标题真是吓人。呵呵。。using System.Resources这个包里面都有,可以查考下,绝对可以实现。我现在的这个项目就是你说的“全球化”哈哈 做了resx文件,程序会根据运行的计算机上的culture自动来找到。如果想认为的来控制culture的话。base.InitializeCulture(); CultureInfo culture = (CultureInfo)Session["Culture"]; if (culture == null) { HttpCookie cookie = Request.Cookies.Get("MyCulture"); if (cookie == null || string.IsNullOrEmpty(cookie.Value)) culture = new CultureInfo("en-US"); else culture = new CultureInfo(cookie.Value); } this.Culture = culture.Name; this.Theme = culture.Name; Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentUICulture = culture; 2005里面自带国际化功能1 打开.aspx文件,切换到页面Design2 TooLs-〉选择Generate Local Resource 后会在项目目录里多出个 App_LocalResources 文件夹和对应此页面的 *.aspx.resx 文件3 在你的.aspx文件里会发生小小的变化 3.1 第一行会变 <%@ Page Language="C#" ... meta:resourcekey="PageResource1" UICulture="auto" %> 3.2 控件属性会变 <asp:TextBox ID="txtProjectName" runat="server" meta:resourcekey="txtProjectName" Width="120px"></asp:TextBox> 提示 在资源文件中添加 txtProjectName.text 的value就可以实现控件text的表示4 按照这样的办法做两个资源文件 比如: 中文的叫G001_Login.aspx.zh-CN.resx 英文的叫G001_Login.aspx.en-US.resx5 重载page基类的 protected override void InitializeCulture() { // get the client browser's defualt language if (Request.UserLanguages != null) { m_strLang = Request.UserLanguages[0].ToLower(); } // if the server implement the client language switch(m_strLang) { case CultureName.Chinese: case CultureName.ChineseChina: case CultureName.ChineseSimplified: m_strLang = CultureName.ChineseChina; break; case CultureName.English: case CultureName.EnglishUS: m_strLang = CultureName.EnglishUS; break; default: m_strLang = CultureName.Chinese; break; } ... } 属性 private struct CultureName { public const string Chinese = "zh"; public const string ChineseChina = "zh-cn"; public const string ChineseSimplified = "zh-chs"; public const string English = "en"; public const string EnglishUS = "en-us"; }6 以后做页面时就继承这个重载类即可 地區:北京年限:2年技術:.Net BS开发工資:avg>>5K + 福利,人性化公司,不加班,工作开心,心情愉快。公司性質:汽车门户网站,国内汽车行业前三名。 PS: 透露点消息,我们公司正在招.net BS开发人员,如果哪位同仁想换工作,是一个不错的机会选择,加[email protected] 说应聘即可! C#连接池如何实现的 c# 调用 WINDOWS API 打印文字 图片 ASP.NET中 Session的使用? 给大家介绍一个学习C#好地方! 会什么点了添加,没有反应,数据到是更新了,但是页面还不行 写发贴机器人遇到的一个问题 .net 初学C#,关于水晶报表的简单问题~!急 winform的datagrid问题 怎样将string的数据类型转化为money类型? 各位帮忙把C#翻译成vb.net 请问用C#怎样做投影程序?
在Form的目录下就会有一个Form1.resx的文件
=================================
谁跟你说没有了???
还有你的标题真是吓人。呵呵。。using System.Resources
这个包里面都有,可以查考下,绝对可以实现。我现在的这个项目就是你说的“全球化”
哈哈
base.InitializeCulture();
CultureInfo culture = (CultureInfo)Session["Culture"];
if (culture == null)
{ HttpCookie cookie = Request.Cookies.Get("MyCulture");
if (cookie == null || string.IsNullOrEmpty(cookie.Value))
culture = new CultureInfo("en-US");
else
culture = new CultureInfo(cookie.Value);
}
this.Culture = culture.Name;
this.Theme = culture.Name;
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
App_LocalResources 文件夹和对应此页面的 *.aspx.resx 文件3 在你的.aspx文件里会发生小小的变化
3.1 第一行会变
<%@ Page Language="C#" ... meta:resourcekey="PageResource1" UICulture="auto" %>
3.2 控件属性会变
<asp:TextBox ID="txtProjectName" runat="server" meta:resourcekey="txtProjectName" Width="120px"></asp:TextBox>
提示 在资源文件中添加 txtProjectName.text 的value就可以实现控件text的表示
4 按照这样的办法做两个资源文件
比如: 中文的叫G001_Login.aspx.zh-CN.resx
英文的叫G001_Login.aspx.en-US.resx
5 重载page基类的
protected override void InitializeCulture()
{
// get the client browser's defualt language
if (Request.UserLanguages != null)
{
m_strLang = Request.UserLanguages[0].ToLower();
}
// if the server implement the client language
switch(m_strLang)
{
case CultureName.Chinese:
case CultureName.ChineseChina:
case CultureName.ChineseSimplified:
m_strLang = CultureName.ChineseChina;
break;
case CultureName.English:
case CultureName.EnglishUS:
m_strLang = CultureName.EnglishUS;
break;
default:
m_strLang = CultureName.Chinese;
break;
}
...
}
属性
private struct CultureName
{
public const string Chinese = "zh";
public const string ChineseChina = "zh-cn";
public const string ChineseSimplified = "zh-chs"; public const string English = "en";
public const string EnglishUS = "en-us";
}
6 以后做页面时就继承这个重载类即可
年限:2年
技術:.Net BS开发
工資:avg>>5K + 福利,人性化公司,不加班,工作开心,心情愉快。
公司性質:汽车门户网站,国内汽车行业前三名。 PS: 透露点消息,我们公司正在招.net BS开发人员,如果哪位同仁想换工作,是一个不错的机会选择,加[email protected] 说应聘即可!