Introduction
Get UICulture
/Current culture in Server Object Model is very easy. In Client Object Model, it is little bit of a problem. So this document aims to overcome it.
What is UICulture/Current Culture
It is the default language of a SharePoint Site. It can be found in Site Settings --> Regional Settings
Using the Code
In Server Object Model, it is already there. SPWeb
has a property named UICulture
. Unfortunately, it is missing in Client Object Model. So what to do? I wrote the following:
public string GetCultureOfTheWeb(ClientContext clientContext)
{
var web = clientContext.Web;
clientContext.Load(web.RegionalSettings);
clientContext.ExecuteQuery();
var localId = (int) web.RegionalSettings.LocaleId;
return new CultureInfo(localId).Name;
}