Try our conversational search powered by Generative AI!

How do I get the Master Language?

Vote:
 

When I use LanguageManager.Translate(string key), it will use the current culture as the language. I don't want that, so I need to use LanguageManager.Translate(string key, string language), which also takes a language parameter like "sv".

I want to use the site's master language, but I don't know where to find the language string for that. Do you?

 

#60647
Aug 21, 2012 9:05
Vote:
 

Hi,


You can retrieve the master language from the startpage, startPage.MasterLanguageBranch.


You can also change the CultureInfo on current thread in OnPreInit

protected override void OnPreInit(EventArgs e)
{
    Thread.CurrentThread.CurrentCulture = new CultureInfo("en");
    Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");

    base.OnPreInit(e);
}

    

#60649
Edited, Aug 21, 2012 9:38
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.