ShareMyPoint ORDINARY KNOWLEDGE : VIVID THOUGHTS

2May/113

SharePoint 2010 Error Changing Variation Label Display Name

I have setup a multilingual WCM site with 6 languages. I created the web application and then setup variations to test the language pack installation. It was a test site with English as my source language. I used the Display Name for each variation which was in written in English rather then using the native language. This is how my variations are setup

VariationLables Wrong thumb SharePoint 2010 Error Changing Variation Label Display Name

My client wanted these display name to be written in native language. I though it should be easy enough to fix this problem. I hovered on "cn" and clicked on edit. I saw that I could change the Display Name property, but could not change the language and Locale. Ok… I changed the display for the Chinese site to "中文" from "Chinese" and to my surprise this is the error I got

VariationLables EditError.png thumb SharePoint 2010 Error Changing Variation Label Display Name

This seems to an error in the control/page. Well as this was a test site I had an option to recreate the variations from ground-up. But what if it were a production site or a development site with lot of customization in place won't be easy task. Well I knew that this information has to stored somewhere and I could get to it using the API. I knew there existed the Relationship list, after poking around a bit and using my favorite tool SharePoint Manager I found that there is a hidden list which stores the declarations for variations. When I try to browse to that list in browser it did not seem to like it. So I decided to use PowerShell to access and change the data here and see if this gets reflected in the Variation Labels page in site settings. So following below is the PowerShell script which worked for me

$spWeb = Get-SPWeb "http://myweb.contoso.com"
$guid = [guid]$spWeb.AllProperties["_VarLabelsListId"]
$varList = $spWeb.Lists[$guid]
$varList.Items | % {
	$curListItem = $_
	switch($curListItem["Flag Control Display Name"]) {
		"Chinese"  { $curListItem["Flag Control Display Name"] = "中文" }
		"French" { $curListItem["Flag Control Display Name"] = "Français" }
		"German" { $curListItem["Flag Control Display Name"] = "Deutsch" }
		"Italian" { $curListItem["Flag Control Display Name"] = "Italiano" }
		"Portuguese" { $curListItem["Flag Control Display Name"] = "Português" }
		"Spanish" { $curListItem["Flag Control Display Name"] = "Español" }
	}
	$curListItem.Update()
}
$spWeb.Dispose()

After going back to site setting and Variation Labels I saw that the display name are updated.

VariationLables Correct thumb SharePoint 2010 Error Changing Variation Label Display Name

Enjoy the power of PowerShell (Swiss knife….wlEmoticon smile SharePoint 2010 Error Changing Variation Label Display Name)

Comments (3) Trackbacks (0)
  1. Great article Sameer!

    I’m running into the same issue today. After performing this change, have you experienced any related issues? Or does the “display name” have minimal / no cascading issues?

    We didn’t realize the issue until we wanted to expose the variation language control in the ribbon as indicated in posts such as the following;

    http://mindsharpblogs.com/daniel/archive/2006/11/29/1396.html

    • Jamie,
      I haven’t experienced any cascading issue. But i am not sure if this wil lbe officially supported by Microsoft. It has to be as they dont have any other way to change it. There are some blog posts which also shows to create the variation hirearchy using the scripts which i am sure is not supported.

      Sameer Dhoot.

  2. We are getting one error on $varList.Items | % { 05 $curListItem = $_ and this powershell is not working after this line.


Reply

( Cancel )


No trackbacks yet.