Building Multilingual Websites
in Drupal 7
Robin Puga
Language embodies the intellectual wealth
of the people who use it. ...
Overview
● Covering the basics
● Multilingual websites in Drupal 7
● Working with translators
● What’s happening in Drupal...
Basics
● Gettext is an internationalization (i18n)
system used for writing multilingual programs
● Drupal Code
$str = t("M...
Blasts in the past - Drupal 5 & 6
http://affinitybridge.comhttp://s.coop/d6convertlang
Drupal 7
● Definitive Guide by Gábor Hojtsy
http://hojtsy.hu/multilingual-drupal7
Read it!
● Books
Drupal 7 Multilingual S...
Drupal 7
● University of Ottawa Calendar
http://uocal.uottawa.ca
English / French
● Participedia
http://Participedia.net
E...
Modules for Drupal 7
● Locale module in core
● Internationalization or i18n module
● Localization Update module
● Entity T...
Setup for Multiple Languages
● Add languages
● Import the .po files
● Configure detection and selection
● Configure your s...
Node level translations
● Now using Entity Translation module
● Setting up the content type
● Synchronizing fields
● Trans...
Entity translations
● Allows translations for entities in Drupal
● User accounts fields
● Comments
● Any entities
http://a...
Field level translations
● One node with translatable fields
● Use case: Products in Commerce
http://affinitybridge.com
Other Modules for Drupal 7
● Variable module
● Translation Table module
● Potx module
● Localization Client module
● Trans...
Translating your site
● Menus
● Same page hierarchy - translate menu links
● Different page hierarchy options:
● One menu ...
Translating your site
● Taxonomy terms
● Localize - one term with translated title
● Translate - different terms per langu...
Translation Interface
● Overview
● Translation Table
● Translate - find strings & translate them
● Import - import .po fil...
Potential Pitfalls
● Indexing in Solr
● Index language fields and filter views by language
fields.
● Adding new language t...
Code Example
Grab this install profile for En/Fr with tools:
https://github.com/robinpuga/multilang
drush make --working-c...
● Translation workflows offline
○ Working with .po files
○ Can be difficult to understand string context
■ “Home” = house ...
Basics
● Gettext is an internationalization (i18n)
system used for writing multilingual programs
● Drupal Code
$str = t("M...
.Po files beyond the basics
● Translation Contexts
$str = t("Home", array(), array('context' => 'Navigation');
● Plural st...
What’s happening in Drupal 8
● Much more in core
● Much of i18n functionality rolled into core
● Better language detection...
Where to find more info & support
● Follow Gábor - http://hojtsy.hu/
● https://localize.drupal.org/news
● https://groups.d...
robin@affinitybridge.com
Questions?
Upcoming SlideShare
Loading in...5
×

Building Multilingual Websites in Drupal 7

1,828

Published on

We will share our experiences developing bilingual websites as well as adding a second language to an existing unilingual website. Building multilingual websites in Drupal has evolved over the years. New to version Drupal 7, we now have field and entity translations in addition to the trusted node-level translations.

In this presentation we will cover: what’s new for multilingual websites in Drupal 7, differences between field, entity and node level translations, techniques for translating various parts of your site, experiences working with translators, and building multilingual websites while being a monoglot.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,828
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building Multilingual Websites in Drupal 7

  1. 1. Building Multilingual Websites in Drupal 7 Robin Puga Language embodies the intellectual wealth of the people who use it. ~ Kenneth Hale
  2. 2. Overview ● Covering the basics ● Multilingual websites in Drupal 7 ● Working with translators ● What’s happening in Drupal 8 http://affinitybridge.com
  3. 3. Basics ● Gettext is an internationalization (i18n) system used for writing multilingual programs ● Drupal Code $str = t("My name is @name.n", array('@name' => $user->name)); ● fr.po file #: src/name.module:36 msgid "My name is @name.n" msgstr "Je m'appelle @name.n" http://affinitybridge.com
  4. 4. Blasts in the past - Drupal 5 & 6 http://affinitybridge.comhttp://s.coop/d6convertlang
  5. 5. Drupal 7 ● Definitive Guide by Gábor Hojtsy http://hojtsy.hu/multilingual-drupal7 Read it! ● Books Drupal 7 Multilingual Sites By Kristen Pol http://affinitybridge.com
  6. 6. Drupal 7 ● University of Ottawa Calendar http://uocal.uottawa.ca English / French ● Participedia http://Participedia.net English then German http://affinitybridge.com
  7. 7. Modules for Drupal 7 ● Locale module in core ● Internationalization or i18n module ● Localization Update module ● Entity Translation module http://affinitybridge.com
  8. 8. Setup for Multiple Languages ● Add languages ● Import the .po files ● Configure detection and selection ● Configure your site content types http://affinitybridge.com
  9. 9. Node level translations ● Now using Entity Translation module ● Setting up the content type ● Synchronizing fields ● Translating content using translate tab ● http://affinitybridge.com
  10. 10. Entity translations ● Allows translations for entities in Drupal ● User accounts fields ● Comments ● Any entities http://affinitybridge.com
  11. 11. Field level translations ● One node with translatable fields ● Use case: Products in Commerce http://affinitybridge.com
  12. 12. Other Modules for Drupal 7 ● Variable module ● Translation Table module ● Potx module ● Localization Client module ● Translation Helpers module http://affinitybridge.com
  13. 13. Translating your site ● Menus ● Same page hierarchy - translate menu links ● Different page hierarchy options: ● One menu per language, or ● Add menu links in different languages ● Blocks ● Now translatable. Works great for static blocks http://affinitybridge.com
  14. 14. Translating your site ● Taxonomy terms ● Localize - one term with translated title ● Translate - different terms per language ● Views ● Filter content by user language ● Translate view titles via Translation Interface http://affinitybridge.com
  15. 15. Translation Interface ● Overview ● Translation Table ● Translate - find strings & translate them ● Import - import .po files ● Strings - refresh translation strings ● Update - grabs po files and updates strings ● Export - export po files from db strings ● Extract - export po files from code files http://affinitybridge.com
  16. 16. Potential Pitfalls ● Indexing in Solr ● Index language fields and filter views by language fields. ● Adding new language to existing site ● Synchronized fields created in English that have translations added later can cause problems. ● http://affinitybridge.com
  17. 17. Code Example Grab this install profile for En/Fr with tools: https://github.com/robinpuga/multilang drush make --working-copy --translations=fr stub.make ../multilang_site http://affinitybridge.com
  18. 18. ● Translation workflows offline ○ Working with .po files ○ Can be difficult to understand string context ■ “Home” = house or homepage ● Translation workflows online ○ Localization Client ○ Access to Translation Tools ○ Identifying content that needs translation Working with Translators http://affinitybridge.com
  19. 19. Basics ● Gettext is an internationalization (i18n) system used for writing multilingual programs ● Drupal Code $str = t("My name is @name.n", array('@name' => $user->name)); ● fr.po file #: src/name.module:36 msgid "My name is @name.n" msgstr "Je m'appelle @name.n" http://affinitybridge.com
  20. 20. .Po files beyond the basics ● Translation Contexts $str = t("Home", array(), array('context' => 'Navigation'); ● Plural strings // These strings are run through the t() function. $str = format_plural($count, ‘1 comment‘, ‘@count comments’); ● fr.po file for plurals #: src/name.module:36 msgid "1 comment" msgid_plural "@count comments" msgstr[0] "1 commentaire" msgstr[1] "@count commentaires" http://affinitybridge.com
  21. 21. What’s happening in Drupal 8 ● Much more in core ● Much of i18n functionality rolled into core ● Better language detection and config ● Name transliteration for machine names http://affinitybridge.com
  22. 22. Where to find more info & support ● Follow Gábor - http://hojtsy.hu/ ● https://localize.drupal.org/news ● https://groups.drupal.org/internationalization ● #drupal-i18n (i18n = internationalization) ● #drupal-l10n (l10n = localization) http://affinitybridge.com
  23. 23. robin@affinitybridge.com Questions?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×