Multiple Language Application with ASP.NET 2.0

xiaoxiao2021-03-06  53

I Tested The Way To Make A Global Application With ASP.NET 2.0Share It Now and Looking Forward to Receiving Your Feedback And Directions.1, Create The Resource File in Resources Folder

Japanese (SharedResource.ja.resx) English (SharedResource.en-US.RESX) 2, in Global.asax,

Void

Application_BeginRequest

Object

Sender, Eventargs E)

{IF (Request.Params ["Language"]! = Null) {if (Request.Params ["Language"]. Tostring () == "jp") {thread.currentthread.currentuicultuicultuicultuiculture = New CultureInfo ("ja") ;} else {Thread.CurrentThread.CurrentUICulture = new CultureInfo ( "en-US");}} else {Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture (Request.UserLanguages ​​[0]);}}

You can see i buy a parameter [language] to swith to switchness language, CERTAINLY WE CAN CHENGE TO SERVER IN ASPX.3, IN ASPX PAGE_LOAD

THIS.LBTOP.TEXT = (String) GetAppResourceObject ("SharedResource", "TOP"

This.lblogoff.text = (string) getAppResourceObject ("SharedResource", "Logoff"

);

Use the method [getAppresourceObject] we can get the string from resource file.

转载请注明原文地址:https://www.9cbs.com/read-116914.html

New Post(0)