Last post Aug 16, 2011 12:43 PM by Mamboking
Aug 14, 2011 07:11 AM|vfortuny|LINK
Hi all,I added to my website in vb.net a LocalResource with a translated content in .resx archives. The translation works properly based on the browser language but i want to change the language from the same page. For this I added the following code in the button event:System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("fr-FR")System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("fr-FR")System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("fr")System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("fr") It does not work, the page stills with the same language.Anyone know how I can change it?
Thank you in advance.
Aug 14, 2011 07:27 AM|rezaxp|LINK
you have to set resources to your controls
Aug 16, 2011 02:13 AM|Yanping Wang - MSFT|LINK
Please refer MSDN article about how to set the current UI culture and current culture
Hope this helps, thanks.
Aug 16, 2011 02:19 AM|vfortuny|LINK
The problem was that i can't put "Protected Overrides Sub InitializeCulture()" in the master page, therefore, i have to put initializeculture in all the aspx pages?
Aug 16, 2011 12:43 PM|Mamboking|LINK
You can do as follow:
1. Put button "Change language" to master page.
2. Put handler that get button event of master page to your .aspx page
3. Put in the handler you code for change culture.
I believe you easily can find sample of getting event from master page on asp.net learn chapters