Workflow Automation

If you develop a website, a good way to increase the translation quality is to let your translators test their translations in context.

You can achieve this by two different ways, depending on the kind of site you develop.

Introduction

Here is how your website request are probably handled.

The translator visit your staging site, request a page, and your server serve pages. The more the translator works on translating your site on WebTranslateIt, the more the staging site and WebTranslateIt get out of sync. We need to update your staging site’s language files. There are two ways of doing so.

Automatically

One great way of doing it is to request a new version of the language files to WebTranslateIt while you process the request. The translator request a page on the staging site, the server analyze the request, download the newest version of the language files to WebTranslateIt, and process the request. This way, translators just have to refresh a page to see their translations in context.

The downside is that it only works for dynamic websites, and requires a little bit of development work.

On-demand

One other way to refresh a staging site is to let translators refresh the language files outside of the request cycle. You could have a web-based tool whose only job is to refresh the staging site’s translations.

Translators access the synchronization console and request the language files to be refreshed. The files are downloaded to the staging site. If your software requires it, some extra tasks can be performed, such as compiling language files, or regenerating the site’s pages. Then, the translator visits the staging site, and see his translations in context.

Implementation

The web_translate_it tool is an open-source tool developed in ruby, that makes it easy to download an upload language files to WebTranslateIt. It can be a great help for implementing these testing techniques.

Automatically

If your app processes requests (a dynamic website), you can usually have this. You can use the web_translate_it client to download the language files at the beginning of the request. How to do it is different to each development framework.

Here is how to use it with Ruby on Rails. After you’ve installed the web_translate_it ruby client, add the following in your ApplicationController file:

before_filter :update_locale

def update_locale
  WebTranslateIt.fetch_translations
end

Restart your application for the changes to take effect. You should see in the logs:

Looking for fr translations...
Done. Response code: 304

And here’s a quick screencast showing how it works.

Introduction to “auto-fetch” from Édouard Brière on Vimeo.


Developers will find detailed information about it on the web_translate_it project page at GitHub.

On Demand

If you use the web_translate_it client, syncing your staging website on demand requires no development work.

On your staging server install the web_translate_it client:

gem install web_translate_it_server

On your project root directory, run:

wti init <api_key>

This will configure your project. You can now run a synchronization server on your staging site by typing:

wti-server

Now go at your staging site’s web address at the port 4000. You should get this web-based interface.

Whenever the button “Get new translations” is clicked, the synchronization server will download new language files from WebTranslateIt.

If you need to run specific tasks to uncache or regenerate your website, you can use hooks before_pull and after_pull hooks.

Developers will find detailed information about it on the web_translate_it project page at GitHub.