0

How to change the site displaying language according to the user ? There is a drop-down to select language in a web page according to that whole site display language change and also user's language in user profile need to change. How to do that in using server side programmatically.

2 Answers 2

1

using variation features. The SharePoint will translate based on your browser language setting.

More info: About SharePoint 2013 display language

-1

If you are using 2010 use following function:

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;
}
}

I don't think the server side equivalent is available for this as all the properties of SPRegionalSettings are Get only, no option for set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.