Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
The Content Translation Support module allows you to export and import page content in translation-friendly XLIFF, CSV and Excel formats. You can send a file to a translator and import the translated content back. The file includes context information and a link back to the page to make translation easier. Export formats are pluggable and can be extended to support a custom format.
Download the Content Translation Support module from Magnolia Store or Nexus repository.
Content Translation Support is an enterprise module included in the Enterprise Edition bundle and typically already installed. Go to Magnolia Store > Installed modules in AdminCentral to check. To install the module individually, see the general module installation instructions.
Please see the general module uninstalling instructions and advice.
The module is ready to use and configured in
The module is fully integrated with the Standard Templating Kit. Your website needs to have at least one locale in addition to the default locale. Locales will show up as columns in the export file. Locales are defined in Templating Kit > Site Definitions. Here's the
/default definition with English as the default locale and German and simplified Chinese as additional locales.
Importers and exporters are Java classes that contain business logic to convert translatable content into convenient format. Out-of-the-box the module provides importers and exporters for XLIFF, Excel and CSV files, and an exporter for Google Spreadsheets.
Importers and exporters are configured in
class: Fully qualified name of the class that contains the business logic. See class names below.
extension: File extension without the dot.
label: i18n key of the label that is displayed in the dialog. See Language on how to use keys.
You can write your own importers and exporters for other file formats or to store translatable text in a database or send it to a Web service that translators use. See GIT for exporter examples.
Commands are configured in
websiteworkspace, in a specified format, for translation.
i18nin the template definitions.
ContentTranslationSupportModule class supports two configuration nodes that define the content types that are exported and imported.
controlTypeToExport: Registers the
editcontrol definitions. These control types contain the textual i18n content.
STKDialogBasedNodeDataToTranslateFinderclass is a STK-specific finder class that finds the relevant i18n content.
The content translation tool allows you to manually export pages for translation and re-import translated pages. The tool is available at Tools > Content Translation.
We use the
googleSpreadsheetExporter exporter to demonstrate. The
GoogleSpreadsheetTranslationBundleWriter exporter class adds the Google translate formula to the CSV exporter. When you upload the CSV file to Google Docs it evaluates the formula and the text is machine-translated into the target i18n languages automatically.
To export content:
The download filename is created from the file path in the
website workspace, with dots replacing forward slashes. In our example
website.demo-project.about.history.csv. The file has the following columns (comma separated headings in CSV or elements in XLIFF):
Text and Image: Subheading. This tells the translator what kind of page element he is translating.
You can upload the file to Google Docs for automatic machine-translation, or to give your translator a useful starting point. In Google Docs ensure that you have the Settings > Upload Settings > Convert documents, presentations, spreadsheets, and drawings to the corresponding Google Docs format option selected.
Here's the History page in Google Docs. You can now download the file and save it as a CSV file for import into Magnolia.
Once the file has been translated you can upload it in the import tool. The translated content is automatically included on the page.
To import translated content:
In Website you can now see the translated content in the components and dialogs.
You can view the translated content in the
website workspace in Tools > JCR. Here the page properties for the History page. The translated content is suffixed with a language identifier,
zh_CN in our example. Since English is the default language on this site no
_en identifier is used.
You can use the Scheduler module to schedule translation export and import jobs.
Here is an example export job that exports content from
/demo-project/news-and-events to an Excel file on the local computer at midnight. You need to pass the following parameters under the
exporter. File format to save in. Choose
csvExporterfor CSV or
googleSpreadsheetExporterfor CSV suitable for Google Docs.
file. Path and file name where to save the exported data.
path. Content to export. This is a path in the
websiteworkspace. All pages under the branch will be exported.
Here is an example of an import job that imports the same Excel file once it has been translated.
You can use the Observation module to listen for changes in the
website workspace and execute the
ExportCommand command when they occur.
Here's an example configuration that executes the
ExportCommand command when a new page is added in the About section of the