最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

WEB頁面多語言支持解決方案

 更新時(shí)間:2006年09月28日 00:00:00   作者:  

首先建立語言檔,在項(xiàng)目中加入.resx文件
例如:
message.zh-cn.resx '簡體中文
message.zh-tw.resx '繁體中文
message.en '英文
..............
=========================================
然后利用Name --Value 鍵值對(duì) 填入你要在頁面上顯示的語言
如:
name value
message.zh-cn.resx中:
res_loginbname 登陸名 :
message.zh-tw.resx中:
res_loginbname 登陸名 :
message.zh-cn.resx中:
res_loginbname Login Name :

=========================================
然后在Golbal.asax中加入多語言設(shè)定支持代碼(瀏覽器需要支持Cookie)

'=========================================
' Application_BeginRequest Event
'
' The Application_BeginRequest method is an ASP.NET event that executes
' on each web request into the portal application.
'
' The thread culture is set for each request using the language
' settings
'
'=========================================
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Try
If Not Request.Cookies("resource") Is Nothing Or Request.Cookies("resource").Value = "" Then
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.Cookies("resource").Value)
Else
Thread.CurrentThread.CurrentCulture = New CultureInfo(ConfigurationSettings.AppSettings("DefaultCulture"))
End If
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture
Catch ex As Exception
Thread.CurrentThread.CurrentCulture = New CultureInfo(ConfigurationSettings.AppSettings("DefaultCulture"))
End Try
End Sub 'Application_BeginRequest

在Web.Config中加入如下代碼,用于設(shè)定編碼和默認(rèn)語種,在Global.asax中有調(diào)用:

=========================================
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<appSettings>
<add key="DefaultCulture" value="zh-cn" />
<!-- zh-cn:簡體中文 zh-tw:繁體中文 en:英文 -->
</appSettings>

 

=========================================
頁面代碼中使用多語言支持:

Imports System.Resources

Public Class 類名
Inherits System.Web.UI.Page
Protected LocRM As ResourceManager = New ResourceManager("項(xiàng)目文件名.message", GetType(類名).Assembly)

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblLogin.Text = LocRM.GetString("res_login")
End Sub
End Class


=========================================

到這里多語言支持的工作就作完了,接下來自己去慢慢Key
message.zh-cn.resx '簡體中文
message.zh-tw.resx '繁體中文
message.en '英文

這幾個(gè)語言檔吧

相關(guān)文章

最新評(píng)論

小金县| 合江县| 荣成市| 庆元县| 普定县| 长沙市| 陆良县| 临沭县| 海淀区| 蓬安县| 嵊州市| 新和县| 新化县| 寿阳县| 独山县| 抚顺县| 丹江口市| 泌阳县| 兴海县| 溧阳市| 遂宁市| 阿城市| 滦南县| 延吉市| 仁怀市| 旬邑县| 香河县| 昆山市| 南涧| 西青区| 浙江省| 潮州市| 罗定市| 丹阳市| 伊春市| 山西省| 绍兴市| 汉源县| 文水县| 济源市| 肥乡县|