Monday, February 6, 2012

Change sharepoint server 2010 Display language from Default language to alternate language programmatically


I found a solution on a following issue to change the default language to alternate language programmatically using which the sharepoint designer's actions and conditions language doesn't change below is the javascript code:
_spBodyOnLoadFunctionNames.push('ChangeLanguage');
function ChangeLanguage()
{
//script fetches current display language
var lcid =_spPageContextInfo.currentLanguage;
//1025 language code for arabic
if(lcid.toString()!=1025)
{
var today = new Date();
var oneYear = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
var url = window.location.href;
//script changes current display language to arabic i.e 1025
document.cookie = "lcid=" + 1025 + ";path=/;expires=" + oneYear.toGMTString();
window.location.href = url;
}
}
If any queries do reply.
Regards,

1 comment: