Advertise Today and target 1500+ SharePoint readers!
Powered by MaxBlogPress  

Get a free email account @sharepointbuzz.com
Sign up
Check e-mail

SharePoint Online
SharePoint BUZZ Logo

Creating Site Variations and Variations Label Menu not working

MSDN has a great article on how to create site variations.   The article walks you through creation of Variation Labels and then viewing the site with the Variations Label Menu.   To enable the site variations label follow these instructions as Microsoft forgot to include in the article:

  1. Open your master page either within SharePoint Designer, Visual Studio, Notepad, etc.
  2. Add a Register TagPrefix to the page (if it isn’t already present)
    <%@ Register TagPrefix=”PublishingVariations” TagName=”VariationsLabelMenu” src=”~/_controltemplates/VariationsLabelMenu.ascx” %>
  3. Place the Variation Menu Label (where you would like it to show up) between the <Form></Form> as follows:
    <PublishingVariations:VariationsLabelMenu id=”labelmenu1″ runat=”server”/>
  4. Check In & Publish the Master page
  5. On your sharepoint server(s) open the ‘VariationsLabelMenu.ascx’ file in notepad - file location: %DRIVE%\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\
  6. You will see that the cms:VariationsLabelIEcbMenu is outcommented with <%– –%> comments. Remove these comment tags and save the file.
  7. Your VariationsLabelMenu works fine now!

Now if for some reason that variation label does not seem to work then you can use my solution which is very simple.  I wanted to provide a client based solution to the Variations Label Menu as a colleague was not able to get it working and was under a time constraint.  Here is my javascript code that will take the current URL, replace the variation label and and change the language:

// Grab the current URL and store it
var str = new String(location.href);

//  Look for en-ca within the URL and replace it with fr-ca
if (str.indexOf(”en-CA”) >= 0 || str.indexOf(”EN-CA”) >= 0 || str.indexOf(”en-ca”) >= 0 ) {
var newStr = str.replace(/en-ca/i, “fr-ca”);
document.write(’<A href=”‘ + newStr + ‘”>FRAN&Ccedil;AIS</A>’);
}

//  Look for fr-ca within the URL and replace it with en-ca
if (str.indexOf(”fr-CA”) >= 0 || str.indexOf(”FR-CA”) >= 0 || str.indexOf(”fr-ca”) >= 0 ) {
var newStr = str.replace(/fr-ca/i, “en-ca”);
document.write(’<A href=”‘ + newStr + ‘”>ENGLISH</A>’);
}

"Creating Site Variations and Variations Label Menu not working" was published on January 7th, 2008 and is listed in Enterprise Content Management, Web Content Management.

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

You must be logged in to post a comment.