Part 1 – The Basics
Part 2 – User Interface
Part 3 – Triggers
Part 4 – Timer Jobs
Part 5 – Configuration Overview
Part 6 – Configuration Internals
Part 7 – Variation Hierarchy Creation
Part 8 – Creating Page Variants
Part 9 – Creating Site Variants
Part 10 – Restructuring the Hierarchy
Part 11 – Variations Fixup Tool
Part 12 – Customization
Part 13 – Logging
Part 14 – Troubleshooting
Part 15 – “View Changes” Button
Part 16 – Translation Support
Part 17 – MOSS 2007 vs. SP 2010
Part 18 – FAQ
Today I will explains how translatable columns and the variation export/import functionality can be used to support content translation
We will cover the following topics:
- Explain the purpose of translatable columns
- Explain how to enable export/import functionality in manage content and structure
- Explain how to translate content and create a new import package
Translatable columns
The site settings menu contains another option which belongs to Variations which we did not yet discuss:
Although not obvious from the name Translatable Columns are part of the Variation Infrastructure.
The purpose of translatable columns is to allow to flag which columns in publishing pages of a site collection should be translated.
Be aware that SharePoint itself does not take care of translation! It also does not support different languages in the same column as the option might imply.
Translatable columns are only used to flag specific columns as translatable when an export package is created to allow an external company to translate the content.
Important: The translateable columns information is only for information to the translator. There is nothing that could prevent the translator to change/translate any other column beside the one marked as being translatable. All changes to any column will be applied when importing the package back into the variation system. As well those columns marked as being translatable and those which are not marked as translatable. |
TranslateFields property
The information about the translatable columns is stored in Xml format the TranslateFields property in the property bag of the root folder of the relationships list in the root site of the site collection:
<Fields>
<Field Id=”52578fc3-1f01-4f4d-b016-94ccbcf428cf”>Comments</Field>
<Field Id=”34a72e09-3ca6-4931-b2e3-f81c40bb87bd”>Description</Field>
<Field Id=”f55c4d88-1f2e-4ad9-19af4ee7ee8″>Page Content</Field>
</Fields>
Export/Import of a variation label for translation
Export/Import using the UI
Looking at a site in a target label in site manager in MOSS 2007 you can see the following two options:
Comparing this with the menu options of a site in a target label on SharePoint 2010 you will miss these options:
To use the Export Variation and Import variation dialog options in SharePoint 2010 it is required to enable these options by editing the _layouts/SiteManager.aspx file:
…
<SharePoint:MenuItemTemplate UseShortId=false id=”OLWebExport” runat=”server” Text=”<%$Resources:cms,SmtExport%>” ClientOnClickScript=”SmtVariationExportWarning(‘%WebExportUrl%’)” Visible=”false” />
<SharePoint:MenuItemTemplate UseShortId=false id=”OLWebImport” runat=”server” Text=”<%$Resources:cms,SmtImport%>” ClientOnClickNavigateUrl=”%WebImportUrl%&%SourceParam%” Visible=”false” />
…
After changing the value of the Visible attribute to true the options are available also on SharePoint 2010.
After choosing the Export Variation option the server will export all pages in the pages library of the site into a content migration package which is streamed back as response to the post request.
Choosing the Import Variation option redirects to a dialog that allow to pick the content migration package holding the translated content.
Important: The dialog seems to imply that the import will be performed into the selected site – but that is not what happens.The Import is performed with RetainObjectIdentity = true – which means that the items in the package will be imported with the same Guid and Url as they were exported. That means if you exported site1 and then select the import option in site2 the import will still be performed into site1. That also means that the import will fail if the items being imported have a different URL as before – e.g. because their Url name has changed or because the site was moved. |
Export/Import using the PublishingService
To allow automated translation of content SharePoint provides the export and import funcationality also through the ExportObjects and ImportObjects methods of the PublishingService web service which can be accessed using the following URL:
http://servername/site/_vti_bin/PublishingService.asmx
There is good documentation on how to use the web service for export and import on MSDN:
- PublishingService.ExportObjects Method
- PublishingService.ImportObjects Method
Content Migration Package for translation
We will not go into all the details of the content migration package here. But I will highlight the relevant parts which are required to implement a translation service.
ExportSettings.xml
The ExportSettings.xml file contains the information about the settings used to export the package and the objects selected to be exported:
<?xml version=”1.0″ encoding=”utf-8″?>
<ExportSettings
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
SiteUrl=”http://servername/”
FileLocation=”C:\Temp\b3c42cb3-922a-4738-878a-bb4df62bd86b”
BaseFileName=”f265b29f-dbb5-4b71-93c6-3e6ed9a89add.cmp”
IncludeSecurity=”None” IncludeVersions=”CurrentVersion”
ExportPublicSchema=”true” ExportFrontEndFileStreams=”true”
ExportMethod=”ExportAll” ExcludeDependencies=”false”
xmlns=”urn:deployment-exportsettings-schema”>
<ExportObjects>
<DeploymentObject Id=”00000000-0000-0000-0000-000000000000″
Type=”ListItem” ParentId=”00000000-0000-0000-0000-000000000000″
Url=”/VarRoot/target/site1/Pages/default.aspx“
ExcludeChildren=”false” IncludeDescendants=”All” />
</ExportObjects>
</ExportSettings>
You will find one DeploymentObject per exported page as the Translation export functionality selects each page explicitly for export.
VariationsLanguageSettings.xml
This file only exists in content migration packages, which are created with the export for translation option.
The file contains the information about source and desired target language to be used for the translation. The information is taken from the configuration of the source label and the exported target label.
<LanguageSettings>
<SourceLanguage>en-US</SourceLanguage>
<TargetLanguage>de-DE</TargetLanguage>
</LanguageSettings>
TranslatableFieldSettings.xml
This file only exists in content migration packages, which are created with the export for translation option – and only if translatable columns are defined in the site collection.
The content of this file will be an exact copy of the value of the TranslateFields property in the property bag of the root folder of the relationships list in the root site of the site collection:
<Fields>
<Field Id=”52578fc3-1f01-4f4d-b016-94ccbcf428cf”>Comments</Field>
<Field Id=”34a72e09-3ca6-4931-b2e3-f81c40bb87bd”>Description</Field>
<Field Id=”f55c4d88-1f2e-4ad9-19af4ee7ee8″>Page Content</Field>
</Fields>
The information in this file should be used by translators – or 3rd party editing tools supporting translators to allow them to decide which column values to translate.
Manifest.xml
This is the file which translators have to work on to translate the content. As changing the markup would cause problems during re-import it is recommended to read the file with a custom tool which provides access only to those columns defined in TranslatableFieldSettings.xml.
<?xml version=”1.0″ encoding=”utf-8″?>
<SPObjects xmlns=”urn:deployment-manifest-schema”>
<SPObject Id=”04f122ee-aeb6-017f-99a7-7447d09414a1″
ObjectType=”SPContentType” …
Url=”/VarRoot/target/site1/Pages”>
<ContentType ID=”0x010100C568DB…” …>
…
<Fields>
…
<Field ID=”{f55c4d88-1f2e-4ad9-aaa8-819af4ee7ee8}”
Name=”PublishingPageContent” StaticName=”PublishingPageContent”
SourceID=”http://schemas.microsoft.com/sharepoint/v3″
Group=”Page Layout Columns” DisplayName=”Page Content”
Type=”HTML” Required=”FALSE” Sealed=”TRUE” RichText=”TRUE”
RichTextMode=”FullHtml” Customization=”” ColName=”ntext6″
RowOrdinal=”0″ />
…
<SPObject Id=”7bda6573-027d-4670-9ebb-c588483b9143″
ObjectType=”SPFile” …
Url=”/VarRoot/target/site1/Pages/default.aspx”>
<File Url=”Pages/default.aspx”…>
<Properties>
…
<Property Name=”PublishingPageContent” Type=”String”
Access=”ReadWrite”
Value=”Content to be translated” />
…
<SPObject Id=”cf8a9bfd-5892-4938-908f-ed9328e305d5″
ObjectType=”SPListItem” …
Url=”/VarRoot/target/site1/Pages/default.aspx”>
<ListItem FileUrl=”Pages/default.aspx” …>
<Fields>
…
<Field Name=”PublishingPageContent”
Value=”Content to be translated”
FieldId=”f55c4d88-1f2e-4ad9-aaa8-819af4ee7ee8” />
Identifying the relevant fields to be translated is not completely straight forward: first you have to identify which field to translate from the TranslatableFieldSettings.xml. Here you can use the Field Id or the field Display Name to find the Field information in the SPContentType object in the Manifest.xml file.
This will allow you to get the Name property of the SPField which is referenced later in the SPListItem and SPFile objects in the manifest.xml file which hold the actual content to be translated.
It is important that as well the content in the SPFile and in the SPListItem object is translated (both will hold the same information).
Permalink
Near the end of this article you wrote, "As changing the markup would cause problems during re-import it is recommended to read the file with a custom tool which provides access only to those columns defined in TranslatableFieldSettings.xml." Are there are any pre-built custom tools available for this?
Permalink
Hi KCRyan, I'm not aware of any prebuild custom tools for this.