Answered by:
Switching global Culture

Question
-
User1464674564 posted
Hi All,
I have a very simple bilingual site with a link at the bottom that will allow users to switch between the two languages (english/french). the the web.config I have the following line:
<globalization culture="auto" uiCulture="auto" />
This allows for whatever the users browser culture is to be the default lanauge but I'd still like the ablility for them to click a bottom button to toggle. whats the best what to go about doing this?
Thursday, August 5, 2010 5:24 PM
Answers
-
User-1734649046 posted
Hi,
Please refer following
hope this helps
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, August 6, 2010 11:17 PM
All replies
-
User-1734649046 posted
Hi,
Please refer following
http://forums.asp.net/t/1386859.aspx
hope this helps
Thursday, August 5, 2010 10:27 PM -
User-242433875 posted
To implement this functionality, you need to override InitializeCulture() method which is best place to specify culture related settings. In this method, you can check which option is selected by user and set the culture accordingly.
Here is the code that you need. In the sample code below, the page's culture is set to English-UK.
Protected Overrides Sub InitializeCulture() MyBase.InitializeCulture() System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB") System.Threading.Thread.CurrentThread.CurrentUICulture = New CultureInfo("en-GB") End Sub
Friday, August 6, 2010 10:51 AM -
User1464674564 posted
Isn't initializeCulture part of the Page base class? how is this done in MVC?
Friday, August 6, 2010 4:14 PM -
User-242433875 posted
I have no clue on how to implement it in MVC, I don't work on it.
Probably, you may refer some MVC forums to find its equivalent or its another better suited MVC implementation.
Friday, August 6, 2010 4:58 PM -
User-1734649046 posted
Hi,
Please refer following
hope this helps
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, August 6, 2010 11:17 PM