16

enter image description here

Is there a way to get the language-switch control as static link in the pagelayout? I want my users to switch between German and English with a single click.

Sorry guys, found a solution :D

<script type ="text/javascript"> 
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;
}
</script>

<a href="javascript:OnSelectionChange(1031)">German</a>
<a href="javascript:OnSelectionChange(1033)">English</a>
  • oh you found answer while I was formatting mine :) – Vedran Rasol Jan 20 '12 at 15:42
  • Answer to your question, in order to mark it as an answered question. – Steve B Jan 20 '12 at 15:43
  • Steve B I need to wait 8 hours before i can -.-' – fr34kyn01535 Jan 20 '12 at 16:17
7

If you examine page source you will see that Select Display Language > Language calls simple javascript:

OnSelectionChange(1033);

Where 1033 is language id.

I have tried launching this form FireFox FireBug console and it works. So your link could be something like:

<a href="" onclick="OnSelectionChange(1033);">English</a>

You can also check this article:

Change language of UI using custom control in SharePoint 2010

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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