Drupalcamp Atlanta 2010 Internationalization Presentation


Published on

Drupal Internationalization / Multi-Language presentation for Drupalcamp Atlanta 2010. Presented by Steven Jackson and Trent Wyman.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Drupalcamp Atlanta 2010 Internationalization Presentation

  1. 1. Getting Started withDrupal TranslationsBy Steven Jacksonand Trent WymanMediacurrent Consultants<br />Drupalcamp Atlanta 2010<br />October 2, 2010<br />
  2. 2. Overview<br />This presentation will cover the basic steps for setting up a multi-lingual site in Drupal<br />Discuss contrib modules needed<br />Cover basic configurations for content type language support<br />Lessons learned from past projects <br /> (Do’s & Don’ts)<br />`<br />
  3. 3. Introduction / Background<br />Trent Wyman<br />Occupation:<br /> - Drupal Developer &Theming Consultant<br />Drupal Experience:<br /> - Began experimenting with Drupal in version 4.7<br /> - Employed as a full-time Drupal Developer & Theming Consultant since version 5<br />Company:<br /> - Mediacurrent (www.mediacurrent.com)<br />About Mediacurrent:<br /> - Web development firm located in Alpharetta, GA<br /> - Focused solely on Drupal Development, customization, & consultation<br />`<br />
  4. 4. Multi-Language Contrib Modules<br />Download the following contrib modules:<br />Internationalization Package (i18n)<br /> - http://drupal.org/project/i18n<br />i18n Auto Translate<br /> - http://drupal.org/project/i18n_auto<br />Language Switcher Dropdown (optional)<br /> - http://drupal.org/project/lang_dropdown<br />`<br />
  5. 5. Enable Drupal Core Modules<br />Go to the modules list page in Drupal admin and enable the following modules under the “Core – optional” section:<br />Locale<br />Content Translations<br />www.yoursite.com/admin/build/modules<br />`<br />
  6. 6. www.yoursite.com/admin/build/modules<br />`<br />
  7. 7. Install Contrib Modules<br />Install the i18n, i18 Auto Translate, & Language Switcher Dropdown modules into your site’s modules folder. <br />www.yoursite.comsitesallmodulescontrib<br />`<br />
  8. 8. Get Your Language Template(s)<br />Choose & download the language(s) you want your site translated into. (http://drupal.org/project/Translations)<br />Unpack the .tar file(s) and install into the i18n/translationscontrib module folder.<br /> (sitesallmodulescontribi18n ranslations)<br />`<br />
  9. 9. Enable Contrib Modules<br />www.yoursite.com/admin/build/modules (“Multilanguage”)<br />Auto draft translation<br />Block translation<br />CCK translation (if using custom CCK fields and fieldgroups)<br />Content type translation<br />Internationalization<br />Language switcher dropdown (if you prefer a dropdown selector v/s Locale’s text links)<br />Menu translation<br />Poll aggregate (if translating polls)<br />Profile translate (if translating user profiles)<br />String translation<br />Synchronize translations<br />Taxonomy translation<br />Views translation<br />`<br />
  10. 10. www.yoursite.com/admin/build/modules<br />`<br />
  11. 11. Configure Installed Language(s)<br />Go to the Languages Settings page in Drupal admin and select the “Configure” tab.<br />Then, under the “Language negotiation” subtab choose the “Path prefix only” option.<br />www.yoursite.com/admin/settings/language<br />`<br />
  12. 12. www.yoursite.com/admin/settings/language<br />`<br />
  13. 13. Enable Installed Language(s)<br />Now, select the “List” tab on the Languages Settings page and enable the languages you installed.<br />Here, you can also set your site’s default language (if other than English).<br />www.yoursite.com/admin/settings/language<br />`<br />
  14. 14. www.yoursite.com/admin/settings/language<br />`<br />
  15. 15. Enable Language Switcher<br />Go to the Blocks admin page and enable the language switcher under the “Disabled” section by assigning the block to your preferred Region.<br />Choose “Language switcher” if only using Locale (core).<br />Choose “Language switcher dropdown” if using the dropdown module (contrib).<br />www.yoursite.com/admin/build/block<br />`<br />
  16. 16. www.yoursite.com/admin/build/block<br />`<br />
  17. 17. Translating Your Site’s Content<br />Go to the “Content types” list page and select the content types that you want translated.<br />Click the “edit” link corresponding to the content type.<br />www.yoursite.com/admin/content/types<br />`<br />
  18. 18. www.yoursite.com/admin/content/types<br />`<br />
  19. 19. Translating Your Site’s Content<br />Next, on the content type’s “Edit” page refer to the “Workflow” section and choose “Enabled with translation”.<br />Then click the “Save” button at the bottom of the “Edit” page.<br />Example path:<br />www.yoursite.com/admin/content/node-type/blog<br />`<br />
  20. 20. www.yoursite.com/admin/content/node-type/blog<br />`<br />
  21. 21. Create New Content<br />Now you can create and translate new content for the content type you enabled for multi-language support.<br />Go to the “Create Content” page, select the content type and then choose “English” (or your default language) from the “Language” dropdown selector.<br />Example path:<br />www.yoursite.com/node/add/blog<br />`<br />
  22. 22. www.yoursite.com/node/add/blog<br />`<br />
  23. 23. Translate New Content<br />After choosing the desired language from the “Language” selector, save the node.<br />Once you have saved the node, click the “Translate” tab located below the content’s title.<br />If this is new content, translations will already be available. <br />`<br />
  24. 24. Example path:www.yoursite.com/node/767/translate<br />`<br />
  25. 25. Translate Pre-existing Content<br />Translations in Drupal are not retro-active.<br />For content that existed before you enabled translations you will need to manually translate those nodes.<br />Click the “Add translation” link next to the desired language. Manually insert your translations into the “Title”, “Body”, etc. fields and save the node.<br />`<br />
  26. 26. Example path:www.yoursite.com/node/56/translate<br />`<br />
  27. 27. Switching Between Translations<br />Once you have your content translated, your users will be able to toggle between the languages by selecting the language links available in your “Language Selector” block (displayed within the Region you assigned on the Blocks admin page).<br />Example of language selector in Header Region:<br />`<br />
  28. 28. Translating Menus & Menu Items<br />Due to limited time I will not go into menu translations for this presentation.<br />For info on how to translate menus and menu items you can refer to the following online tutorials:<br />http://drupal-translation.com/content/adding-menu<br />http://becircle.com/translating_menus_drupal_6<br />http://drupal.org/node/275705<br />`<br />
  29. 29. Introduction / Background<br />Steven Jackson<br />Occupation:<br /> - Drupal Consultant<br />Drupal Experience:<br /> - Mainly backend module development<br /> - Server deployment<br />`<br />
  30. 30. How to make it work, 1<br />Start with a plan<br />Start with using i18n<br />Don’t do it as an afterthought<br />Know what languages you are using<br />Try to keep as much in Drupal – hardcode as little as necessary<br />`<br />
  31. 31. How to make it work, 2<br />Put what you can in the node<br />Translate interface is good but may be cumbersome to search<br />Might have duplicate or similar text but in different locations<br />If doing after the fact, make node_clone your friend<br />`<br />
  32. 32. How to make it work, 3<br />If a social site, setup content_profile<br />Can then translate profile content in same manner<br />Coordinate with someone who knows the languages<br />`<br />
  33. 33. How to make it break<br />== !previousSlides<br />Don’t plan ahead, buy lots of Tylenol<br />Don’t wrap module text in t()<br />Write output in direct PHP instead of via Drupal<br />`<br />
  34. 34. What can go wrong<br />Server not rendering special characters<br />Pathauto, url_alias may create new path when saving node after initial creation<br />Have to go into db and clear aliases and auto urls for content<br />Get a lot of some-path-name-0<br />`<br />
  35. 35. How fix what you break, 1<br />IF PHP<br />You’ll want to parse the URL to get language or get $language->language<br />if/switch language to output correct language text<br />Make friends with regex, might have to output some special characters that some PHP functions aren’t generating (like date())<br />`<br />
  36. 36. How fix what you break, 2<br />IF PATHAUTO, URL_ALIAS<br />Often ran into new url being generated when merely updating content<br />Go into db, remove path_auto, url alias associations<br />Reassociate nodes via the translate tab<br />`<br />
  37. 37. Pros / Cons<br />Pros<br />Well, you have a multilingual site<br />Only had to setup one code base<br />Cons<br />If not planning ahead can be a headache<br />Might feel like you created multiple sites despite auto generation<br />`<br />
  38. 38. Things to Remember<br />Setup translation auto-generation<br />If doing after the fact, setup translation associations<br />Setup each view to be based on user’s current language in filters<br />`<br />
  39. 39. Questions / Comments?<br />`<br />