人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當(dāng)前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開發(fā)教程 > 詳細(xì)頁面

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

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

更新時間:2022-08-07 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

首先建立語言檔,在項目中加入.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中加入多語言設(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("項目文件名.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 '英文

這幾個語言檔吧

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 六安市| 河源市| 乌拉特中旗| 沐川县| 临夏市| 佳木斯市| 洛浦县| 冀州市| 海兴县| 黎平县| 双柏县| 绿春县| 宁远县| 攀枝花市| 阜康市| 隆子县| 永新县| 石楼县| 仪陇县| 凉山| 霞浦县| 循化| 泸西县| 伊金霍洛旗| 万荣县| 台山市| 黄龙县| 和龙市| 西和县| 申扎县| 镇巴县| 饶平县| 岚皋县| 长沙市| 紫金县| 佛学| 宁远县| 景东| 华容县| 进贤县| 阿巴嘎旗|