实现多国语言
用cookie存储 EN,CN等等关键字
打开页面的design,然后tools-->Generate Local Resource
生成App_LocalResources文件夹及.resx文件
配置空间的.Text ,Title,ToolTip 然后在页面中使用meta:resourcekey="关键字"掉用
如在.resx中 RadDockZone1Resource1.ToolTip hello world
在.aspx中 meta:resourcekey="RadDockZone1Resource1"
所有页面的.cs中 : System.Web.UI.Page改为继承BaseWebUIPage :BaseWebUIPage
BaseWebUIPage 类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;
using System.Threading;
/// <summary>
/// Summary description for BaseWebUIPage
/// </summary>
public class BaseWebUIPage : System.Web.UI.Page
{
public BaseWebUIPage()
{
}
protected override void InitializeCulture()
{
//string selectedLanguage = "zh-CN";
HttpCookie cookie = Request.Cookies["CultureInfo"];
if (cookie != null && cookie.Value != null)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(cookie.Value);
Thread.CurrentThread.CurrentCulture = new CultureInfo(cookie.Value);
}
else
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");
Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");
//Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-AU");
//Thread.CurrentThread.CurrentCulture = new CultureInfo("en-AU");
}
base.InitializeCulture();
}
}