Leveraging The Translation System

Barebones CMS offers content authors a powerful multilingual translation system. Each page in a website can have multiple translations. When a page loads, the system attempts to determine what language the user prefers reading and serves up matching content. If the system fails to find a match, it falls back to the default translation.

If you only plan on delivering content in one language, then you can ignore this. This documentation aims to serve as a guide on the translation system for those who plan on utilizing multiple languages for a website.

The Translation Team

If you are just getting starting on translating content for the web, there are a number of things you need to do. The first step of this process is setting up a translation team that will do the bulk of the work and getting them to communicate their needs to the rest of the development team.

Translating content is not just cloning a page and converting words. Images, audio, video, and symbols have to be translated too. Plus there are locale-specific needs to consider such as right-to-left reading, the layout in one language may be inappropriate for another language, and anything else that is culturally-sensitive needs to be addressed. Translating anything into another language is hard work. If it were easy, automatic translation tools such as Babelfish, Google Translate, etc. would be 100% accurate all the time.

The hardest part of translating content for the web is that it is very difficult to keep two copies of the same content in perfect synchronization. This is why a dedicated translation team is absolutely necessary. An alternative is to use a translation service. They tend to do good work, but can be expensive to retain their services.

For those starting out, it helps to pick out a specific set of pages for translation, no more than two target languages, and then decide on how frequently the team will update the translated pages. This keeps the task simple enough to accomplish.

Creating Translations

Once the translation team is ready to go, it is time to create a new translation of a page in the target language and begin editing the content.

The 'Create Translation' dialog.
The 'Create Translation' dialog.

Before creating the language, make sure you know its IANA language code. After that, follow these steps to create the new translation:

In most cases, the target language is in the 'Language' drop-down list. The default list is known as the list of "Common Languages". Once the first translation has been created, that language is added to the list of "Site Languages" to quickly locate it in the future. The Site Languages list is cached in the root directory in the 'iana_lang_desc_cache.php' file. If the language selected is not in the Common Languages list, it can take a few seconds to load the IANA database to validate against and identify the language. After the initial lookup, the results are cached for very fast lookups in the future.

IANA periodically updates its database of codes and mappings. This database is retrieved prior to releasing new versions of Barebones CMS. If the translation system is used extensively, it is a good idea to delete the 'iana_lang_desc_cache.php' file and let Barebones CMS recreate it after each upgrade of Barebones CMS.

Managing Translations

The initial translation is simply a clone of the first language's page. This should help reduce the amount of work that has to take place to perform the translation of a page.

The 'View Translations' dialog.
The 'View Translations' dialog.

Managing a translation and its translation mappings is done via the 'View Translations' dialog in the Page Options menu. This dialog allows translations of a page to be identified at a glance and quickly jump to view them, enter the editor for the translation, and delete translations and mappings.

Translation mappings are a key part of the translation system. For instance, if a user arrives with a preference for 'en-gb' (English, United Kingdom) but the site supports only 'en' (English) and 'en-us' (English, United States), there is no exact match. However, the system attempts to search for 'en' after failing to find 'en-gb'. Now it sees that there is a match to 'en'. However, 'en' is just a language mapping to 'en-us'. The end result is that 'en-us' gets served up to the user.

From within this dialog, the default language can be set. The default language is used when no match is found and the system gives up looking. Only actual translations can be set to the default language - not language mappings. Also, the default language cannot be deleted from the system.

Notifying Translators

Communicating with the translation team is incredibly important to keep translated pages synchronized with each other. For this reason, the translation notification system exists.

The 'Notify Translators' dialog.
The 'Notify Translators' dialog.

To notify translators of a change to a page:

Try to be polite/civil since there is no tracing who sent the message in the system. I figure most people are big boys and girls and therefore everyone can behave like adults. Again, Barebones CMS is built for teams of people who can trust each other.

Note that this system doesn't send e-mails or anything similar. It is an entirely self-contained system and quite simplistic. However, it is possible to create plugins that hook into the system to extend it.

Processing Notifications

Once a translation notification has been sent, it appears in the notifications queue.

The 'View Notifications' dialog.
The 'View Notifications' dialog.

To access the queue, click 'View Notifications' in the Site Options menu. If there are any tasks to deal with, the dialog will appear.

It is up to the translation team how they want to handle items in the notification queue. It is a good idea to keep the queue empty by deleting items as they are completed and to divvy up the tasks as they come in. As stated before, communication among team members is absolutely essential to maintaining synchronization between pages.

Keep in mind that the notification portion of the translation system is simplistic. Your translation team may eventually outgrow it.

© CubicleSoft