Content Translation in Drupal 7

Nov 10, 2011 · by Suzanne Dergacheva

Content Translation in Drupal 7

Nov 10, 2011 · by Suzanne Dergacheva

Multilingual websites are complicated, due to the wide variety of ways to convey multilingual content to users. Each multilingual website seems to come with a different set of requirements for how content translation is handled. In this post, I'll take a look at approaches to translating content in Drupal 7 and the new possibilities that the Entity Translation module provides.

But first, some shameless self-promotion: if you're interested in Drupal i18n, please vote for my Drupalcon Denver session: Don't Get Lost in Translation: Multilingual Site with Drupal 7.

Do You Need to Translate Content?

For some multilingual websites, having content be translated across multiple languages isn't feasible or necessary. User generated content (like comments) should often remain in the language of the submitter. Sites targeting multiple regions might have a section per country with content just in the primary language.

Often, there's a compromise that certain content is translated (often static content like 'About Us') while dynamic content isn't (blog posts, podcasts). In Drupal, content translation is handled on a per-content-type basis, so you have control over whether each content type can be translated or not.

Displaying Untranslated Content

If content isn't translated, what do users see? For some audiences, it makes sense to show the untranslated content. For example, in Montreal, a large percentage of the population is bilingual, so displaying untranslated content is really useful.

Even in cases when you don't expect your audience to speak an alternate language, they might appreciate seeing the untranslated content. For example, on a reviews website, I'll appreciate seeing that a restaurant has 30 reviews and that the average rating is 4 stars, even if the reviews themselves are in a different language.

Methods of Translation Content in Drupal 7

In Drupal 7, there are two methods of content translation. Translation at the node level is provided by the Content Translation module and translation at the field level is provided by the Entity Translation module. You can translate different types of content differently, because the method of translation is selected on a per content type basis.

Administer Translated Nodes

Translation of Nodes (Content Translation module)

Content Translation is a core Drupal module that allows you to translate nodes. When you translate a node, a new node is created. Translated nodes are mapped together, but they are distinct nodes that can be treated separately. For example, the author and date of publication will often be different, and translated nodes don't have to appear in the same menu.

Content Type Multilingual Support Options

Translation of Fields (Entity Translation module)

The Entity Translation module lets you translate particular fields, while only a single node or entity is created. For example, translating a blog post won't create a new node, you'll just be adding translations of certain fields to the original node. Which fields are translated is configurable, so you can choose to make the body translatable, but leave other fields, such as the blog post image, untranslated.

Field Translation Setting

Field-level translation is particularly useful for content types that have language-independent fields or components. For example, an event node might have an associated list of signups. Since all users are signing up to the same physical event, you don't want to manage a separate signup list for each language. There are lots of situations when having a single node is useful because the state of the nodes should be the same in all languages:

  • Issues that have a status
  • Blog posts that can be bookmarked by users
  • Products that are involved in transactions
  • Content in a hierarchy
  • Content that needs to be published/unpublished at the same time in all languages

When dealing with lots of nodes in lots of languages, creating a new node for each language can also be problematic, and translation at the field level avoids this.

Entity Translation works on the field level, so only elements that are fields can be made translatable. In Drupal 7, this means that you have to use the Title module to convert the title to a field so that it can be translated. Some other elements, like the menu settings, can't be translated.

Entity Translation works for all kinds of entities that have fields, not just nodes. It provides a way to translate taxonomy terms, users, and comments as well.

What about the Synchronize Translations module?

Synchronize Translations is a submodule of the Internationalization module (i18n). This module allows you to synchronize certain fields across languages when translating nodes with the Content Translation module. While it provides some of the same results, it works very differently from the entity translation module. A node is still created in each language, but when a synchronized field is updated in one language, all the node translations are updated to use the same field.

Content Type Multilingual Support Options

When using Drupal 6, this provided a good way to deal with situations when node elements needed to be the same across languages (i.e. author, taxonomy terms, etc). However, it doesn't resolve problems like synchronizing the status of a node (when using the Flag module) or synchronizing a list of signups for an event content type.

For Drupal 7, Synchronize translations is useful for situations when you want to maintain two separate nodes (for example, because you want the nodes to appear in different places in the menu), but you still want to synchronize certain fields.

Onwards and Upwards with Content Translation in Drupal

The Drupal 8 Multilingual Initiative, let by Gábor Hojtsy, aims to move the features provided by the Entity Translation module into core. Work is underway to improve other aspects of Drupal's language capabilities for Drupal 8.

Meanwhile with Drupal 7, we have more options for translating content than ever before. The Entity Translation module provides an elegant solution for translation on the field level, while Content Translation still gives us the option of translating nodes. While all these options might be confusing, they allow us to build more sophisticated multilingual sites in Drupal than ever before.