2011-10-23 22 views
2

我有一個多語言的網站...
我做了兩個文件夾在視覺工作室的語言(EN +我的語言),並使我的網站爲每一個!
一種語言的網站,我有一類爲改變文化和日曆,我的文化和callled該類Global.asax中象下面這樣:什麼事件(地點)應該用於在多語言網站中更改文化和日曆?

protected void Application_BeginRequest(object sender, EventArgs e) 
{ 
    myLanCultureAndCalendar.SetCultureAndCalendar(); 
} 

但對於多語言網站,我能做些什麼關於類?
這意味着我應該在哪裏爲每種語言調用該類?
my pages are base on master and content pages

如你所知global.asax Application_BeginRequest runs First -> after that we have content page_Load -> and at last Master page_Load

回答

1

我認爲你必須實現的Application_BeginRequest事件類......這樣的..

protected void Application_BeginRequest(Object sender, EventArgs e) 
{ 
    String language = Request.UserLanguages[0]; 
    if (language.Length > 1) language = language.Substring(0, 2); 
    ....... 
    ........ 

} 

我建議你請去通過這個鏈接more info

我希望它能幫到你..

+0

t hank解答/但是有沒有使用UserLanguages的另一種方式? – MoonLight

+0

任何其他的想法?這個問題似乎不好使用用戶的機器語言/我們可以使用會話或類似的東西嗎? – MoonLight