Appendix 2: Drupal and languages

Last updated on
28 October 2024

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

(This page is left intentionally blank, including a few extra words to pass the ten-word limit.)

Drupal in a non-English language

Drupal has good support for creating websites using other languages than English. This chapter presents how to switch the user interface from English to another language – see the multilingual Drupal sites section for information on how to have several languages present on a site.

In this example, Swedish will be used as the non-English language.

The initial version of this section of the Community Documentation came from the book Drupal 7: The Essentials, courtesy of NodeOne and Johan Falk.

Installing contributed translations

When using Drupal in a language other than (US) English, the contributed translations are an invaluable asset, providing translations of thousands and thousands of expressions and strings.

Installing contributed translations with Localization update

The module Localization update drastically simplifies the process of installing new languages by automatically downloading and installing from Drupal's central translation repository. It can also notify you when there are updated translations available, allowing you to update your site.

With Localization update, the language installation process is as simple as this:

  1. Install the Localization update module, the same way as other modules. This will require you enabling the core Locale module, used to allow translation of the user interface.
  2. Go to the toolbar, Configuration, Languages and click on the link add language. (See figure A2.1)

  3. Figure A2.1: The language overview page, including the link for adding new languages.

  4. Select which contributed translation you want to add. (See figure A2.2)

  5. Figure A2.2: Drupal has a large number of pre-defined languages, most of which have contributed translations.

  6. Click the add language button and wait for Localization update to download and install the translations for Drupal core and any contributed modules you have enabled. (See figure A2.3)

  7. Figure A2.3: Localization update will fetch available translations for Drupal core as well as for contributed modules. You will appreciate this step in particular if you have previously installed translations manually.

  8. When the import is done, you will be redirected to the language overview page, where you can select the new language as the default language on your Drupal site. This will make Drupal display administration links, description texts and other parts of the user interface in the chosen language rather than English. (See figures A2.4 and A2.5) Easy as that!

  9. Figure A2.4: The language overview page, now with Swedish freshly installed.


    Figure A2.5: The language overview page, now with Swedish set as default language.

Adding or editing translations

Since Drupal and its contributed modules are in a state of constant development, you will most likely find parts of your interface that are not yet translated. You may also discover translations that you would like to change to make them fit better with the terminology used on your site.

Drupal has built-in tools to translate strings in the interface right on your website. You find the tools in the toolbar, Configuration, Translate interface and finally the tab Translate. The resulting page contains a search function to find text strings (verbatim expressions) on your site. (See figure A2.6) Each search result has a link for creating/editing its translation. Clink on the link to set the translation to whatever you like!


Figure A2.6: Drupal has a built-in tool for allowing site administrators to set or update translations.

If you don't find the text string you want to translate, it is probably because one of the following factors:

  • Drupal has not yet loaded the text string. Only strings that have been displayed are recognized by Drupal and available for translation. Visit a page where the string is displayed and try searching again.
  • You have set small or capitalized letters differently from how the string is stored, the search function is pretty picky about this. Check your spelling and search again.
  • You're trying to find a string that contains a variable, such as Hello admin. Try searching again, excluding any parts that you suspect are variable. (Hello admin is actually stored as Hello @username, to allow translations of variable phrases.)
  • The string you want to translate is not a part of Drupal's own interface, but the configuration, such as the content of a block or a node. Configured strings need special tools to become translatable.
  • The string you want to translate is not passed through Drupal's translation function. Since all interface text should be passed through the translation function, you have found a bug and the module maintainer will probably be happy if you report this at the module's issue queue.

When translating strings that include variables, you should make sure that the variables are included even in the translated string or Drupal won't be able to vary the string content correctly. The string Hello @username, for example, should be translated to Hej @username in Swedish.

When changing translations, you should be aware of the fact that new translations (in most cases) will be used at all places where the English original phrase turns up. Changing the string Save, for example, will affect nearly all forms on your website.

Translating with Localization client

The Localization client module provides a number of tools useful when making more extensive translation work. The two most important are:

  • Pop up boxes used to search text strings and creating translations, available on every page when a non-English language is selected.
  • Functions to contribute translations to Drupal's translation repository at localize.drupal.org. (See the toolbar, Configuration, Languages and the Sharing tab.) If you do this, you should also consider getting involved in your local translation team. Visit localize.drupal.org for more information.

The Localization client features are not described in detail in this book.


Figure A2.8: The Localization client module is a good tool if you need to translate large parts of your website, rather than just a few strings.

Installing translation updates

The Localization update module not only allows you to import contributed translations, but also to fetch and apply translation updates when they become available.

By default, you have to check for updates manually. This can be changed by going to the translation updates tab found at the toolbar, Configuration, Languages. The configuration page also allows you to determine how locally changed translations should be treated – either keeping them on new updates (default), or overwriting them if their remote translations have changed.

You may check for translations updates manually by visiting the update tab in the toolbar, Configuration, Translate interface.

Multilingual Drupal sites

Building a website that is able to present content in more than one language requires a fair amount of planning. What content types should be available in more than one language? Should the nodes be translated, or should each node be created for one language at a time, independently of each other? How should taxonomy terms be handled? Menus? Is it enough to have administration pages in one language only? Should labels for entity fields be translated too? Which views should display all content, and which should be language-sensitive?

This chapter describes the basics in managing Drupal content in more than one language and gives some advice about where to find information on more advanced multilingual options.

The initial version of this section of the Community Documentation came from the book Drupal 7: The Essentials, courtesy of NodeOne and Johan Falk.

Translating nodes

The first and most important things to translate are the nodes on a website. For many websites it is enough if a handful nodes are translated to more than one language.

To allow translations of nodes you have to enable the Content translation module (included in Drupal core). To use it to any effect you must also have more than one language available on your site.

With Content translation enabled you will find a few new settings available for each node type. See the toolbar, Structure, Content types and the edit link for each node type. Under publishing options, a setting multilingual support is now available with the following options (see figure A2.8):

  • Disabled: This will give nodes of this type the default site language.
  • Enabled: This provides a language selector for each node of this type. (This option is available as soon as the Locale module is enabled.)
  • Enabled, with translation: This option not only allows you to make nodes language-specific, but also to translate nodes into other languages.


Figure A2.8: The Content translation module allows handling nodes in more than one language.

TIP: Changing language settings for a node type doesn't affect any existing nodes. Normally you want to set the language options for node types before content is created.

Editing nodes with language support enabled

When creating or editing nodes with language support enabled, there is a new field available: language. This option allows selecting the language used for the node, or selecting language neutral.

At nodes with translation functionality enabled, site administrators will see a new tab: translate. It leads to a page listing all available translations of the node and offering links to create new translations. (See figure A2.9.) In the list of translations, one of the nodes is marked as source. This is used as the original text for the other nodes and its content will be copied into node forms when creating translations.


Figure A2.9: Translatable nodes have a new tab, used to overview or create translations.

With translatable nodes come a few new functions that help site visitors and administrators.

  • Each node has links leading to any existing translations. (See figure A2.10)
  • When editing source nodes, there is an option flag translations as outdated is available in the translation settings fieldset. (See figure A2.11) If checked, all translations will have a corresponding checkbox this translation needs to be updated checked.
  • The content overview page (content in the toolbar) has a new filter option for status, outdated translation, making it easier to find content that needs to be updated.


Figure A2.10: Nodes with translations get links to each translation.


Figure A2.11: When editing a source node, all its translations may be marked as outdated.

Deciding active language

With more than one language available on your site, there is of course also the question of which language should be displayed. Drupal has several ways of selecting this:

  • By domain name or path prefixes for each language, such as en.example.com and sv.example.com, or example.com/en/node/1 and example.com/sv/node/2.
  • By a parameter in the request or session, such as example.com?language=en.
  • By detecting language settings in the visitor's browser.
  • By reading the language settings in a logged-in user's account.

You may select which of these options should be used, and how they should be prioritized, by visiting the detection and selection tab at the toolbar, Configuration, Languages. The prefix used for each language can be changed at the language overview page, by following the edit link for each language.

TIP: The Locale module provides the block language switcher, with convenient links for switching between different language versions of the same page (where available). You must enable language detection by prefix to use this block.

More tools for multilingual sites

On most sites, you will get very far by having the interface in one single language and some information pages translated into several languages. But on some sites, this is not enough. The starting point for making truly multilingual sites is the Internationalization module. This module offers, among other things:

  • Multilingual options for taxonomy terms and vocabularies, similar to those previously described for nodes.
  • Multilingual options for menus.
  • Translatable blocks, and block visibility settings based on language.

The project page for Internationalization contains a number of useful links for anyone who wants to read more about multilingual issues, and also lists more modules extending the multilingual capabilities of Drupal.

Help improve this page

Page status: Not set

You can: