If you required to set localization / culture in your custom web application that is running in IFRAME section of your CRM Application, according to User preferred language selected by user in Language option, go with the following
Override the InitializeCulture() method in your custom web application as
protected override void InitializeCulture()
{
base.InitializeCulture();
WhoAmIRequest whoAmIRequest = new WhoAmIRequest();
WhoAmIResponse whoAmIResponse = (WhoAmIResponse)crmService.Execute(whoAmIRequest);
// Get the usersettings entity
RetrieveUserSettingsSystemUserRequest reqUserSettings = new RetrieveUserSettingsSystemUserRequest();
reqUserSettings.EntityId = whoAmIResponse.UserId;
ColumnSet columns = new ColumnSet();
columns.Attributes = new String[] { "uilanguageid" };
reqUserSettings.ColumnSet = columns;
reqUserSettings.ReturnDynamicEntities = true;
CrmNumberProperty langProp = null;
int langCode = 0;
try
{
//Get current logged in user setting
RetrieveUserSettingsSystemUserResponse resUserSttings = (RetrieveUserSettingsSystemUserResponse)crmService.Execute(reqUserSettings);
DynamicEntity objUserSettings = (DynamicEntity)resUserSttings.BusinessEntity;
foreach (Property prop in objUserSettings.Properties)
{
langProp = (CrmNumberProperty)prop;
if (langProp.Name.Equals("uilanguageid"))
{
//langCode = (CrmNumberProperty)objUserSettings.Properties["uilanguageid"];
langCode = langProp.Value.Value;
break;
}
}
//Set culture
Thread.CurrentThread.CurrentCulture = new CultureInfo(langCode);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(langCode);
}
catch (System.Web.Services.Protocols.SoapException se)
{
// Log it
}
}
If you are looking for Retrieve Cultures information from CRM into your Custom Web Application, have a look at
http://faisal.azmza.com/post/CRM-Retrieve-Cultures-information-from-CRM-into-your-Custom-Web-Application.aspx