Categories
PowerShell SharePoint

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

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

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

Enjoy the power of PowerShell (Swiss knife….Smile)

By Sameer Dhoot

Welcome to my blog. I am IT Professional with 10 years of experience across several IT disciplines. I am currently based in Farmington Hills, Michigan, USA. I hope that you find my blog of interest. It is mostly around Microsoft platform including SharePoint, SQL Server, TFS, Windows OS, Virtualization as this is what I am currently working on, but my aim is to write about all of the competencies described in my profile and write contents which I believe can be helpful to broader audience (IT Pros) and may include general computing advice, how-to's, FAQ, Tips and Tricks. I would welcome contributors and critics who would help to build this blog in terms of better contents and usability.

3 replies on “SharePoint 2010 Error Changing Variation Label Display Name”

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.