Try our conversational search powered by Generative AI!

CultureInfo getting set to en-US ????

Vote:
 
I set the culture in the globalization of the web.config to en-GB. Now if I put 2 breakpoints in my code - one directly before the base.Init() call (which will initialize the EPiServer Template page) and one directly after. Then I test the culture of the current thread. The first breakpoint reports correctly that it is EN-GB, but after the base.Init() call it is reported as EN-US ???? My machine (the server) has it's regional settings as EN-GB. The only language configured in the admin mode is EN-GB. The default web site language has been set to EN-GB (even though I have not set Globalization to true since it is a single language site). Anyone got any ideas ????? Thanks in advance, Jim
#12839
Nov 20, 2006 21:32
Vote:
 
Hi Jim, I haven't tested this extensively, but some digging around in Reflector gave me this understanding of the matter: EPiServer does not use the element in web.config to set the culture. 1. If the page has a language (under the advanced tab), this language code will be used. 2. If the user is logged on, and has selected a language, this will be used if no language has been defined for the page. 3. If the two above fails, the EPsLanguage code from web.config will be used. 4. If EPsLanguage is not set, it will default to EN (1033). The language code ("NO", "EN", "EN-GB") will be used to load more language information, including the locale to use for the: Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo() call done by EPiServer in the LanguageContext class. If you look in Admin, Config, Edit Language Codes you can see all the available languages. The Language Key is the one used on the page and in web.config. The locale column is used to look up the culture. To have the default culture on your site be en-GB, change the locale from en-US to en-GB here. If you need to distinguish between en-US and en-GB you can follow the steps Jeremy Norman outlines in his blog: http://episervernz.blogspot.com/2006/09/in-my-language-please.html Logically, changing EPsLanguage from EN to EN-GB should give me the correct result if I inspect the Thread.CurrentThread.CurrentCulture before and after Init in my template. It does not. It always give me en-US. Changing the locale of EN in admin does work though. Do you see the same on your system? /Steve
#14975
Nov 21, 2006 13:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.