Tuesday, July 17, 2012

Language Dropdown for SharePoint 2010 Variations

If you are using SharePoint 2010 variations for multilingual purposes, there is a native SharePoint user control to switch between languages. The control is named “VariationsLabelMenu” and resides in the 14 hive, C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\VariationsLabelMenu.ascx
By default this control is hidden and if you are using a custom master page it might not been added to the master page. In that case you can use following markup in the master page to add this control.
<!-- Register dll -->
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<!-- Add control and datasource -->
<PublishingWebControls:VariationsLabelEcbMenu id="variationLabelMenu" DataSourceID="LabelMenuDataSource" DisplayText="" IsCallbackMode="true" runat="server" /> 
<PublishingWebControls:VariationDataSource id="LabelMenuDataSource" LabelMenuConfiguration="1" Filter="" runat="server"/>


Note: As mentioned in different places, the language (variation label) dropdown is disabled to improve performance. Also you can experience slowness in loading dropdown items with this control.

No comments: