Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to set label and description for non-default language programmatically. Similar to what is described in this video: http://www.youtube.com/watch?v=d-eY9mP3EHU (sec 0:35).

I tried using: term.CreateLabel("Complexe Salle de Réunion", 1036, true); But this adds the label to "Other Labels" for English instead of "Default Label" for french.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

If I understand your question you are working with Managed Metadata? In order to create different labels for different languages you need to install the Language Packs for those languages first. After that you will have the ability to create language specific terms and synonyms for those.

Note: I'm using the free General Business Taxonomy from WAND in the example. And, I've got English and Swedish Language Packs installed. English LCID = 1033 and Swedish = 1053.

Using PowerShell:

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Taxonomy")
If ((Get-PsSnapin |?{$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
    $psSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
}

# Get Central Admin Web Application
$caWebApp = (Get-SPWebApplication -IncludeCentralAdministration) | ? { $_.IsAdministrationWebApplication -eq $true }
# Get SPSite reference from Central admin Web Application
$site = Get-SPSite $caWebApp.Url

$taxonomySession = Get-SPTaxonomySession -Site $site
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
$group = $termStore.Groups["General Business Taxonomy"]
$termSet = $group.TermSets["General Business Taxonomy"]

Create a term specifying Swedish as LCID. Note that this will also create an English term as English is specified as the default language.

$termSet.CreateTerm("___Test___", 1053)
$termStore.CommitAll()

Check the result:

$termSet.Terms["___Test___"].Labels


 IsDefaultForLanguage                            Language Term                                Value                              
 --------------------                            -------- ----                                -----                              
                 True                                1033 Microsoft.SharePoint.Taxonomy.Term  ___Test___                         
                 True                                1053 Microsoft.SharePoint.Taxonomy.Term  ___Test___                         

So, you can see we created a Swedish term and the system added an English term. This is because English is configured as the default language and there must always be a default version of the term.

If you want to update the term, for example changing the English label:

$term = $termStore.GetTerms("___Test___", $false)
foreach ($label in $labels) {
    if ($label.Language -eq 1033 -and $label.IsDefaultForLanguage -eq $true) {break;} 
}
$label.Value = "___EnglishTest___"
$termStore.CommitAll()

Check the term again (note that the indexer uses the default label for the default language):

$termSet.Terms["___EnglishTest___"].Labels

which gives you:

IsDefaultForLanguage                            Language Term                                Value                              
--------------------                            -------- ----                                -----                              
                True                                1033 Microsoft.SharePoint.Taxonomy.Term  ___EnglishTest___                  
                True                                1053 Microsoft.SharePoint.Taxonomy.Term  ___Test___                         

Good luck!

share|improve this answer
    
This was very helpful. Thanks Björn! –  user6900 Jun 28 '12 at 13:45

If I understand your question correctly, what you want to do is to add other languate text for title and descriptions for a field in a list. you can do that by setting field.titleresource and field.descriptionresource values.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.