Subscribe for expert
tips and access news

Internationalisation of your Drupal website

Amarjit Bharath   —   28 January 2013   —   Code & Drupal

i18n page on Drupal.org

Update: for some background information about internationalisation take a look at our article "Introduction to internationalising and localising websites"

Who needs internationalization?

Need your site translating into Japanese, Chinese, French or even all three? The Internationalization (i18n) module coupled with the Drupal core will make available all the functionality you need to create a fully-featured multilingual website.

Starting the project from scratch will allow you to scope the project out and get it right the first time. Since Drupal is scalable in both directions (easily removing and adding functionality), adding multilingual capabilities is achievable to an existing Drupal site or even a Drupal site that is already multilingual. It will just need a little extra scoping out to ensure all content is successfully translated and layouts work for the copy.

If you have a current Drupal site or just need a multilingual site, drop us a line for a quick chat to discuss your requirements – we are happy to help.

Also have a peek at debgroup.com to see some of Internationalization’s super functionality. There are a few other contributed modules and custom modules coupled in but they are used for the finer points.

Why you need multi-lingual

Firstly your site as multilingual, would instantly give access to wider audience across the globe. The drop in PC prices, innovations such as the Raspberry PI computer and increasing availability of the internet has increased online usage year on year. It could potentially mean increased revenue via more traffic to your site.

If you plan on expanding your business overseas in the future, it would be cost effective to implement your multilingual content early on. As your site expands with new content and layouts, it can become time consuming to scope and develop the system.

Your multilingual site creates trust between yourself and your customers. Users will appreciate your website offers them accessibility in terms of content; especially if your competitors are not doing the same; And if they do have a multilingual website, why haven’t you?

Search engines will drive customers to your translated content, as they will appear in search results that are common to the languages you offer on your site.

By using Drupal, you can own multiple country domains that redirect to the same codebase. Drupal will detect which language the user is trying to access and automatically show them the requested translated content. You could even direct users automatically based on their region by IP address.

The module(s)

Drupal core comes with some functionality that allows you to translate content straight out of the box; Content Translation (D6/D7) and Entity Translation (D7/D8).

I18n (as it's commonly known because of the 18 characters between the I and the N) will add much needed functionality on top of that.

So let’s first talk about what Drupal’s core modules can do:

The Locale module is built into Drupal 7 and is used to translate interface elements such as, system strings, menu items and text labels.

The Content Translation allows you to translate whole content types, such as articles and products. Each translation for that piece of content would all belong to a ‘translation set’. This would allow you to have a separate URL alias per content.

Entity Translation (not compatible with D6) on the other hand allows the translation of any number of fields within an Entity or piece of content.

The built in modules will gives you that initial functionality but i18n adds so much more:

Internationalization contains a plethora of sub-modules. Each one is important so it is advised to know what each one is capable of:

  • Block languages - Block can be translatable and also have the ability specify what language the block will appear in.
  • Contact Translation - Translation of site contact forms
  • Field Translation - Translate data associated with fields, e.g. help text, default value and list options.
  • Menu Translation - Allow translation of custom menus

The Multilingual Content module has a number of features, such as:

  • Allows you to set the currently selected language as the default for new content.
  • Set a flag for content types to require the user to select a language for new content.
  • Able to also set content to be defaulted to Neutral language. This is used if content does not need to be translated in any language, e.g. Contacts.
  • Set a flag to lock the language option once content is created.
  • Translate content type configuration (such as content type name) if Drupal's core String translation module is enabled.
  • Multilingual forum - Helps with Drupal's core forum configuration to allow it to be used with multilingual.
  • Multilingual select - Filters core pages according to selected user language. For example, the homepage on Drupal's default install will show all nodes. These will be filtered by language.
  • Path translation - Allows you to create translation sets based on paths. For example, creating a translation set for a specific View with page attachments.
  • String translation - Allows you to translate strings from the 'source language' (selected via settings). On the other hand, the Locale module only allows you to translate from the English language. Be sure not to change the source language if you use this module, as it will break your translations. This module also allows you to select which input formats can be translated. This is useful if you have for example, PHP scripts stored within content fields.
  • Synchronize translations - A field can be flagged with a 'synchronize' option. So when a user updates a piece of content; for any nodes in the translation set, will have their fields updated with the new values. The user will be notified of which nodes have been updated.
  • Taxonomy translation - This module gives you a set of 4 options when creating a Taxonomy Vocabulary. These state how the content (if it should) should be translated.
  • Translation redirect - If a user or crawler visits the site using a node URL; they are 301 redirected to the translated page or source page, if no translation exists. For example, if 'node/101' represents an English piece of content and the user visits /fr/node/101, the user will be redirected to the translation of 101 in French.
  • Variable translation - Translate variables that exists in the settings file and database. For example, ‘site_name’.

The i18n module is large but enables a complex multilingual site to be set up. The configuration needs to be set up perfectly from the start, as once content has started to be added; it will be difficult to make changes that won't affect current content.

Some other modules you may be interested in that work with i18n:

  1. Localization update - Automatically download and update your translations fetching them from localize.drupal.org or any other Localization server.
  2. Transliteration - Provides one-way string transliteration (Romanization) and cleans file names during upload by replacing unwanted characters.
  3. Internationalization Views - Translate views using Internationalization

Alternatives

There are many tools on the market and one of those comes from Google. Google Translate  offers 60+ languages, all of which you can add to your site with a few simple clicks. These sorts of services are great for non-commercial sites that have low traffic. The problem is that the translated content have no real URL’s – meaning they will never appear in the search indexes. On top of this, fixed layouts will be broken – meaning your site will not look right with overflowing and layouts breaking. A bespoke website’s layout should fit around copy perfectly.

Using a custom solution with Drupal and i18n, you can override layouts based on language or even regions. Of course, you would need to browser test every language (all latest + IE7 + IE6 in some of our projects). Further more you can filter results based on language and create custom URL’s for a set of translations; using the automatic transliteration settings on URL’s to be able to use the native language within the path.

Final message

Internationalization allows some complex multilingual integration to your sites. It’s mostly deciding what modules you need and enabling them;  as most of the setup is done via configuration settings.

As a Drupal developer, you may add as many languages to your hearts content.  As well as this,  you can you translate the frontend copy and the entire backend! You’ll find that many contributors of Drupal have already submitted translation strings for your administration side; which is already included as part of the package.

If you need tips on getting started, head over to the i18n documentation. There are also many good video tutorials for those of you who prefer visual learning.

Now get setting up i18n for Drupal, allowing your end users to enjoy your site in their native language.



Our Partners / Accreditations / Networks

0161 872 3455

Sign up to our newsletter