SharePoint Javascript 改变当前站点语言

Sharepoint 2010 - Change UI Language with javascript

If you want to use html/javascript to change UI language, you can use the script below:
(Note: in the page, there is the function OnSelectionChange, so you have to change name if you want to use other feature in)

function OnSelectionChange(value)
{
    var today = new Date();
    var oneYear = new Date(today.getTime() + 365 * 24 * 60 * 60 * 1000);
    var url = window.location.href;
    document.cookie = "lcid=" + value + ";path=/;expires=" + oneYear.toGMTString();
    window.location.href = url;
}

And in page, set the flags for change language:

<a href="javascript:OnSelectionChange(1040)">
    <img width="32" height="20" src="/SiteAssets/flag_ita.png" border="0" alt="Italiano"/>
</a>
<a href="javascript:OnSelectionChange(1033)">
    <img width="32" height="20" src="/SiteAssets/flag_eng.png" border="0" alt="Inglese"/>
</a>
 

你可能感兴趣的:(JavaScript)