Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How to get the current site language in admin mode

Vote:
 

Hi colleagues,

I have page created on 'EN' language (page id: 6068) and fallback sv->en.

I switch the language to 'SV' in the admin mode (url: http://localhost:81/EPiServer/CMS/?language=sv#context=epi.cms.contentdata:///6068) and see page on 'EN' language.

How do I get 'SV' language on the page (not from url)?

OR Is it possible to determine once the page has not yet been translated into 'SV'?

The following options are returned 'EN' language:

1) var pageRouteHelper = ServiceLocator.Current.GetInstance();
var c = new LanguageSelectorContext(pageRouteHelper.Page);
LanguageSelector.AutoDetect(false).SelectPageLanguage(c);

2) ContentLanguage.PreferredCulture.Name

...

Thanks

#117399
Feb 20, 2015 6:50
Vote:
 

Hi,

I'm not sure how to do this because you configured a fallback language. What I do know is that you could hook into the functionality where EPiServer sets the ContentLanguage and replacement language. I wrote a blog about it last week: http://www.patrickvankleef.com/2015/02/13/force-a-page-to-display-in-a-specific-language-dynamically/

Patrick

#117400
Feb 20, 2015 8:27
* 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.