Setting up a multilingual Open Outreach site

There’s lots of great documentation about setting up a multilingual Drupal site on drupal.org (https://www.drupal.org/documentation/multilingual). See in particular the post How To: Basic Internationalization Setup (https://www.drupal.org/node/1268692) where much of this documentation was gleaned from.

Getting started

  • Download your Open Outreach site as usual, with English as the language.
  • Enable the Locale and Content translation modules (core) and the Transliteration module (it may have already been enabled depending on the features you enabled.)
  • Download and enable Variable (https://www.drupal.org/project/variable), Internationalization  (https://www.drupal.org/project/i18n), Localization Update (https://www.drupal.org/project/l10n_update) and Internationalization Views (https://www.drupal.org/project/i18nviews using the version that corresponds with Views) modules.
  • Depending on your uses, you’ll likely also want to enable many of the Internationalization sub-modules:
    • Block languages
    • Contact translation
    • Field translation
    • Internationalization
    • Menu translation
    • Multilingual content
    • Multilingual select
    • Path translation
    • String translation
    • Synchronize translations
    • Taxonomy translation

 

Translation sets

  • Under configuration/regional and language/language/add language, select the language you want to add. The language files for your selected language will be added. This will take some time.
  • Once finished, the new language will be shown in the list view. English, will show as the default language. If you want to change the default language, you should do so now before further work on the site proceeds.
  • Under the Detection and selection tab, you can select the methods for identifying how the language preference should be detected.
  • Under the Translations tab, you can select settings for updating translations.

 

Switching languages

  • A language switcher block will be available for adding to your desired region. Navigate to admin/structure/block and place the block Language switcher (User interface text) into a region (the second sidebar will be a consistent choice for Open Outreach).
  • Using this block, you can now switch into your second language and see how much of the interface is translated.

 

Translating content

  • The first  step in setting up multilingual content is setting each content type you will be using to be multilingual.
  • Navigate to structure/content types (admin/structure/types) and for each content type select the edit tab.
  • Under publishing options, set the multilingual support to Enabled, with translation. Save.
  • Now when you create a new piece of content that you wish to appear in two (or more) languages, create the piece first in the default language (in our example English). Fill in all the fields in English and select English as the language. Save.
  • Once saved, you will now see a tab, Translate. Use this tab to add the translation, filling in all the fields in your second language and selecting that language form the select list. Save.
  • For existing posts you wish to add a translation to, you can manually update the publishing options for a particular node and then set the language, adding the translation (either directly or if nodes already exist in both languages then by adding the translated node to the translation set.)
  • Many languages use accents which it is helpful to have stripped out before creating the URL path alias. Navigate to configuration/search and metadata/url aliases/settings (admin/config/search/path/settings) and check transliterate prior to creating alias.
  • For some content types (for example, highlighted), you may want to enable the synchronize functionality to enable you to upload the image only once but have different text in your differnt language.
  • Set the multilingual support settings as described above (enable, with translation), then save.
  • Now return to this content type and under the synchronize translations tab, select image and save.

 

Working with views

  • This requires going in and making some adjustments to the views in use for content display so that only content with the desired language will be displayed. Even if you’re not familiar with views, some of the changes will be quite straightforward to make.
  • The following change can be used for article, blog, highlighted and link.
  • Navigate to the main views administration page (admin/structure/views) and click the edit link for the corresponding view (article, blog, highlighted, link).
  • The change you need to make is to add a filter so that only posts in a particular language will be displayed.
  • Under filter criteria click the Add button.
  • Find the Content translation: language and add it.
  • Then configure it by selecting Current user’s language under the language section. Save.
  • Now the blog landing page will show only the blog posts in the selected language.
  • Because the homepage is made up of a collection of views, once all the relevant views have the current language filter added, the home page will show only those items that are in the current user’s language.

 

Translating menu and menu items

  • Navigate to structure/menus/main menu/translate (admin/structure/menu/manage/main-menu/translate). Here you can translate the menu title and the description (translate tab).
  • Under the edit menu tab, select Translate and localize to enable you to translate menu links.
  • Under the List links tab, you will need to edit each menu item you’re using and set the language to English and save.
  • Then you can select the Translate link for each item and provide the translation for the selected language. If the menu path is a node, you will first need to translate the node. Ensure you add in a description for the language as well for the hover over link.
  • This method will give you menu links in each language, which may be cumbersome with a large menu link set. You can also use a method to translate the menu strings, following the same basic steps as for working with taxonomy terms (see below.)

 

Translating strings

  • Depending on the language you’re using, much of the interface will be translated. There will be parts of Open Outreach and its related Debut features set that are not though, so you may need to go in and add translations for strings in use.
  • Start by ensuring that your strings are up-to-date for the area you’re working on, such as views, by visit the translate interface, strings tab (admin/config/regional/translate/i18n_string). Check the text groups you want to refresh and then click the refresh strings button. This may take some time to refresh.
  • Next, navigate to the translate tab and search for the string you want to translate, using the filtering system to narrow down your search, for example to strings in views. Once you’ve found the string, click the edit link, add your translation and save. You’ll likely need to flush caches for your translations to take effect.

 

Translating vocabularies and taxonomy terms

  • The Taxonomy translation sub-module provides four different ways you can translate vocabularies and terms. Your particular website may have needs that are best served by a specific choice. Read more about the four options at https://www.drupal.org/node/1114016.
  • For many sites, the simplest method will be to select the Localize option. This will ensure that there is not a duplication of the terms but rather that they are translated using the translation interface (but still have the same term ID).
  • Each vocabulary can be set differently so you can also fine-tune how this works for various types of vocabularies. For example, some may want the same terms translated and for others there may be different terms in the different languages.
  • Navigate to the main taxonomy page (admin/structure/taxonomy) and select the edit  vocabulary link for the vocabulary you want to update. Choose the option of multilingual support your want, for example localize, then save (or save and translate which will take you to the translate interface where you can add the translation for the vocabulary name and description.)
  • To translate terms using the localize method, visit the translate interface to ensure your strings are up-to date (admin/config/regional/translate/i18n_string), checking taxonomy and refreshing.
  • Then select the translate tab, and find your string, filtering by taxonomy to limit your search. Edit to add your translation and save.