六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

ASP.NET WEB頁面多語言支持處理方案

[摘要]首先建立語言檔,在項目中加入.resx文件例如:message.zh-cn.resx '簡體中文message.zh-tw.resx '繁體中文message.en '英文..............=============================...

首先建立語言檔,在項目中加入.resx文件

例如:
message.zh-cn.resx '簡體中文
message.zh-tw.resx '繁體中文
message.en         '英文
..............

============================================
然后利用Name --Value 鍵值對 填入你要在頁面上顯示的語言
如:
                                      name                      value
message.zh-cn.resx中:  res_loginbname            登陸名 :
message.zh-tw.resx中:  res_loginbname            登陸名 :
message.zh-cn.resx中:  res_loginbname            Login Name :

=============================================
然后在Golbal.asax中加入多語言設定支持代碼(瀏覽器需要支持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中加入如下代碼,用于設定編碼和默認語種,在Global.asax中有調用:

================================================
    <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("項目文件名.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         '英文

這幾個語言檔吧,這是一個痛苦的回憶!


語言的后綴 如:
zh-cn'簡體中文
zh-tw'繁體中文
en   '英文

可以參考 IE選項---網際網絡設定--〉一般選項卡語言--〉新增里邊的內容




主站蜘蛛池模板: 午夜影院在线播放 | 日日操夜夜添 | 在线中文字幕一区 | 亚洲bt天堂 | 亚色网站 | 日韩视频欧美视频 | 青娱在线 | 三级精品视频在线播放 | 欧美性猛交xxxx乱大交be | 亚洲欧美在线视频 | 亚洲成在人线影视天堂网 | 日韩黄色小说 | 天色噜噜噜噜 | 偷自拍视频区综合视频区 | 香蕉啪 | 中文字幕精品一区影音先锋 | 深夜国产一区二区三区在线看 | 日韩欧美一区二区不卡看片 | 日韩精品视频免费在线观看 | 日产精品一区到六区免费 | 青青草手机在线视频 | 青青草视频免费在线 | 日本色护士 | 亚洲欧洲精品视频在线观看 | 亚洲国产精品成人综合色在线婷婷 | 手机看片精品高清国产日韩 | 乌鸦传媒在线视频国产 | 我想看一级毛片免费的 | 中文字幕午夜乱理片 | 日本无卡码免费一区二区三区 | 亚洲人成亚洲精品 | 四虎午夜 | 欧美亚洲桃花综合 | 在线观看精品国产福利片100 | 在线播放亚洲视频 | 中文字幕第二一区 | 伊人久久大香线蕉资源 | 一级毛片在线免费视频 | 欧美在线视频免费看 | 天天做爽夜夜做爽 | 伊人久久天堂 |