November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Can you try CultureInfo.CurrentUICulture instead? That one should be just "en".
That would work for the EN-case. However, we also have "nn-NO" (nynorsk) enabled as a language. The problem is that the CurrentUICulture returns "NO" for both NO (which is really nb-NO) and nn-NO. I need to get the exact languagebranch from EPiServer in order to separate these languages. So using CurrentUICulture is unfortunately not a solution.
Try CurrentPage.LanguageBranch it returns the culture as set in admin-mode. I use it for "en-GB" for example and works fine.
/René
I have tried using CurrentPage.LanguageBranch. It returns the LanguageId in the format I need, but there is a problem when fallback-languages are enabled. The languageId of the current page is returned. If this page is shown in a fallback-language, the returned value is not the same as the CurrentLanguageBranch selected by the user.
Example: The user has chosen to view the site in language "nn-NO" (nynorsk). A page does not exist in this language and is shown in its fallback-language "NO" (norsk bokmaal). Then CurrentPage.LanguageBranch will return "NO", but the CurrentLanguageBranch should still be "nn-NO". CultureInfo.CurrentUICulture also return "NO" in this case. If I use CultureInfo.CurrentCulture I get the correct "nn-NO" in this case, but this will be wrong when "NO" is chosen as a language. Then it will return "nb-NO" (not recognized as "NO" from admin-mode") as described in my original post. In 4.61 LanguageContext.Current.CurrentLanguageBranch returned the correct value I was looking for.
Hi,
I'm trying to get the current languagebranch in CMS5. In 4.61 this was done using LanguageContext.Current.CurrentLanguageBranch. In CMS5 I'm doing this in the following way:
EPiServer.DataAbstraction.LanguageBranch.Load(System.Globalization.CultureInfo.CurrentCulture);
In our EPiServer-site we have configured the languages "NO" and "EN", which are selectable from the list in admin-mode. The problem is that when "NO" is selected, the CultureInfo.CurrentCulture will be "nb-NO". The LanguageBranch.Load method does not find the LanguageBranch, and returns null. The same is the case when "EN" is selected, then the CultureInfo.CurrentCulture becomes "en-US". This seems strange, since "EN" can be selected as a language in EPiServer. Changing the LanguageID from "EN" to "en-US" is not possible in admin-mode.
Does anyone know how this can be solved? Is there another way to get the current languagebranch in CMS5?
Thanks.
#Roy Are