Kentico CMS 7: Translation workflow processes
In this article we’re going to combine the power of two new features of Kentico CMS 7 to make the process of creating multilingual Web solutions simpler than ever before!
I’ve already introduced the brand new Translation services module in my previous blog post (http://devnet.kentico.com/Blogs/Stepan-Kozak/March-2012/Kentico-CMS-7-Translation-services.aspx
) and Jaroslav has introduced the Advanced workflow feature (http://devnet.kentico.com/Blogs/Jaroslav-Kordula/May-2012/Kentico-CMS-7-Advanced-workflow.aspx
). Why not to get the most out of both solutions to save your editors' time?
The aim of this post is to show you how to automate the process of translation of your website. I’ll demonstrate how to define the process so that your default culture documents are automatically sent for translation using any service provider you want. To automate the process further, I’ll also show you how to set up a custom workflow so that once your translators upload the translated version, it gets imported automatically without need of any interaction on your editors' part. Sounds interesting? Let’s get started.
Defining "Send for translation" workflow process
As you can see in the Advanced workflow module, there are two translation-related workflow actions ready to use out of the box. The first of them is the "Send for translation" action. This action does the obvious – once your document gets to this step, it makes sure that it’s properly exported and sent for translation via your specified translation provider.
Let’s make a sample workflow process which employs this action functionality. Go to Site Manager / Development / Workflows, click "New advanced workflow" and create it with scope set to "Documents", so it looks like the following figure:
Now on the "Steps" tab, define your workflow process. Let's make a single-approval workflow process where, once the document content in the default (en-US) culture is approved by a responsible editor, it gets published and the document is sent for translation (to Czech) using an e-mail translation provider.
For the approval step, use the "Standard" workflow step. The more interesting part from the translations point of view is the usage of the "Send for translation" action. After you drag & drop the actions and connect them, your workflow process can look similar to this.
Now let’s configure the action so it uses the manual translation provider. Click the properties button of the "Send for translation" step and configure it as depicted in the following figure.
(Note that these properties reflect those when you submit a document for translation manually via the "Create new culture version" dialog).
The last thing which remains is a configuration of the workflow on the "Scope" tab. The scope of documents to apply to, is of course up to you, I just want to point out that it’s important that you define this scope only for your default culture
(provided you create your new documents in default culture and want to use this culture as a base for translation).
And that's it for the first phase – now whenever you create a new document in the section covered by the defined scope, it's automatically sent for translation (you can manage the submission in a standard way in CMS Desk / Tools / Translations).
Defining the "Import translation" workflow process
The second phase is the automatic import of a translation. Once your submission gets to a "Translation ready phase" (i.e. your translator uploads the translated version) you might want to import this translation automatically without going to CMS Desk / Tools / Translations. Let's define the second advanced workflow which does exactly this.
Again, go to Site Manager / Development / Workflows and create new "Import translation" workflow for documents. The process will be bit more complex this time, but it's a nice example of how to use the advanced workflow functionality.
Our aim is to import the translation of the document once it’s ready and to publish it. Since a new culture version of the document is created immediately at the time it's sent for translation, (the created version is a copy of the default culture version with a flag "Waiting for translation"), we need it to wait actively for the translation. That's why we put a "Wait" step which will periodically check whether the translation is ready and if it is, than we will use the predefined "Import translation" action to import the translated version.
Let’s go step by step. First drag and drop a Wait action, a Condition action and an Import translation action to the workflow process as depicted in the following figure:
Now we configure each step. Let’s start with the edit step. In order to start checking for translation immediately as soon as the new language version is created, we need to set timeout for the edit step to proceed automatically to the next (Waiting) step. Go to properties of the Edit step and set up the timeout for one minute.
Once you save the step properties, a new source point will appear. Connect this source point to the next (Wait) step. In the properties of the Wait step, set the interval – this will determine how often you want to check whether the translation is ready (you can coordinate this with a scheduled task which checks the external translation services and downloads translated XLIFF to submission data – for example once a day).
Next is the condition step. Here we want to check whether the translation of the document is ready in its submission. If it is, we want to move to the Import translation step. If it’s not ready, we want to go back to the Wait step. For the condition text you can use the prepared Macro method IsTranslationReady(). The condition step setup may look like this:
The last thing you need to do is to connect the steps in the final workflow process. A sample is depicted in the following figure.
Now whenever your editor creates a new document in the English culture, a Czech version is created automatically (copied from the English version), translation submission is created and sent for translation via e-mail. Once your translators upload the translated version it gets automatically imported and your page is translated. Pretty simple for what you get, isn’t it? :)
Update: To avoid any confusion, this functionality will be available only in Kentico EMS license.