Multilingual Drupal presentation from "Do it With Drupal"

82
Drupal world domination Translating interface and content in Drupal Gábor Hojtsy, Acquia Inc. December 12 2008, Do It With Drupal, New Orleans http://acquia.com / http://doitwithdrupal.com /

description

Introduction to the Drupal 6 multilanguage features starting off from core features to contributed modules. Presented at Do It With Drupal http://doitwithdrupal.com/

Transcript of Multilingual Drupal presentation from "Do it With Drupal"

Page 1: Multilingual Drupal presentation from "Do it With Drupal"

Drupal world dominationTranslating interface and content in Drupal

Gábor Hojtsy, Acquia Inc.December 12 2008, Do It With Drupal, New Orleans

http://acquia.com/ • http://doitwithdrupal.com/

Page 2: Multilingual Drupal presentation from "Do it With Drupal"

About the presenter

Web developer since 1999, building open communities and contributing to open source projects ever sinceWorks with and contributes to Drupal since 2003Drupal 6 branch maintainerCode gardener at Acquiahttp://acquia.com/

Page 3: Multilingual Drupal presentation from "Do it With Drupal"

Will demo with Acquia Drupal

Curated distribution of Drupal 6 Connects to the Acquia NetworkNot a fork in any way of the included software, all GPLYou can do everything shown with Drupal 6 and the modules mentioned in the session

Page 4: Multilingual Drupal presentation from "Do it With Drupal"

About you

Built non-Drupal multilanguage site?Built Drupal based site?Built Drupal based multilanguage site?

“Decision makers”?“Users”?“Developers”?

Page 5: Multilingual Drupal presentation from "Do it With Drupal"

Drupal 6 language subsystem

Page 6: Multilingual Drupal presentation from "Do it With Drupal"

Two worlds, one family

Text from inside module and theme code is translated for you–These can be pre-translated by international teams–Distributed and shared freely on drupal.org

All custom content you generate is your job to translate–Content on the website, taxonomy, menus–Text in views, content type !elds, and so on...

Generally different ways to approach the two

Page 7: Multilingual Drupal presentation from "Do it With Drupal"

And there is a lot more to do

Relating translations (complete copies, subsites)Different permissions, lifecyclesSetting up work#owsIntegrating with external toolsJust selecting the language to use is complex

Page 8: Multilingual Drupal presentation from "Do it With Drupal"

Drupal 6 language subsystem

Page 9: Multilingual Drupal presentation from "Do it With Drupal"

The installer

Page 10: Multilingual Drupal presentation from "Do it With Drupal"

Install in your language

After pro!le is selected, Drupal looks for available translationsOffers translations to useLanguage packages can be downloaded and extracted into Drupal root for useFiles in /pro!les/pro!lename/translations/ are consideredFiles are imported in a batch (progress bar)

Page 11: Multilingual Drupal presentation from "Do it With Drupal"

Start screen of the default pro!le

Page 12: Multilingual Drupal presentation from "Do it With Drupal"

Some languages extracted to Drupal

On the installer interface.In the !le system.

Page 13: Multilingual Drupal presentation from "Do it With Drupal"

Translated (almost)!

Page 14: Multilingual Drupal presentation from "Do it With Drupal"

Translated (almost)!

Page 15: Multilingual Drupal presentation from "Do it With Drupal"

Translated (almost)!

Page 16: Multilingual Drupal presentation from "Do it With Drupal"

Translated (almost)!

Page 17: Multilingual Drupal presentation from "Do it With Drupal"

Translated (almost)!

Page 18: Multilingual Drupal presentation from "Do it With Drupal"

Imports translations automatically

Page 19: Multilingual Drupal presentation from "Do it With Drupal"

The runtime knows about languages

Page 20: Multilingual Drupal presentation from "Do it With Drupal"

Properties of languages known

The default language for the websiteEnglish and native language namesWriting direction support (LTR or RTL)De!ned ordering (weights)Path pre!x or (sub)domain associatedAdminister » Site con!guration » Languages

Page 21: Multilingual Drupal presentation from "Do it With Drupal"

Adding new languages

Extract interface translations to Drupal rootAdd language from prede!ned list if possible

Page 22: Multilingual Drupal presentation from "Do it With Drupal"

Automated translation import

Modules and themes also have ./translations subdirectoriesWhen you add a language, all enabled modules and themes get translations importedWhen you enable a module or theme, translations imported in all languagesAdminister » Site building » Translate interface

Page 23: Multilingual Drupal presentation from "Do it With Drupal"

The language to use to display the page

Can be set to be always the site defaultOr pick the !rst identi!ed from this list:–IRI (domain name, path pre!x)–User preferences–Browser language preference settings–Fallback on site default

Which of these is used exactly is con!gurable at Administer » Site con!guration » Languages » Con!gure

Page 24: Multilingual Drupal presentation from "Do it With Drupal"

Example language setups

Using path pre!xes–German language set up with /deutsch path pre!x–Hungarian language set up with /magyar path pre!x

Using subdomains–German language on de.example.com–Hungarian on hu.example.com

Or even use high level domains–German on beispiel.de–Hungarian on példa.hu

Page 25: Multilingual Drupal presentation from "Do it With Drupal"

Server setup for multiple domains

Make sure that all domains point to the same virtual host in your webserver con!gurationDrupal should automatically pick up the domain from the requestIf using subdomains, make sure that cookies are set on *.example.com, not per subdomainIf using standalone domains, you will not be signed on on multiple domains at once just by logging in at one of them

Page 26: Multilingual Drupal presentation from "Do it With Drupal"

Language is known, now what?

Drupal selects the language, but it is up to the rest of the modules used to act accordinglyThe interface is displayed in that languageWebsite settings, views, etc. might need more tweaking to behave as you wishGetting “custom content” such as custom menu items, taxonomy terms and site settings to translate requires contributed modules

Page 27: Multilingual Drupal presentation from "Do it With Drupal"

Right-to-left (sub)theme support

Remember admin/settings/language to revert.

Page 28: Multilingual Drupal presentation from "Do it With Drupal"

Right-to-left (sub)theme support

Drupal itself includes RTL support for all its functionalityAll CSS !le additions are intercepted and RTL cascade !les are searched for (eg. style-rtl.css for style.css !les)All core themes have RTL supportEasy to write RTL supporting themes, even with color module

Page 29: Multilingual Drupal presentation from "Do it With Drupal"

Language dependent path aliases

Page 30: Multilingual Drupal presentation from "Do it With Drupal"

Language dependent e-mails

Users have their preferred language set upThose registering on a translated page get that as preferred language by defaultThis language is used to send e-mails, such as welcome or new password request e-mailDrupal 6 can send e-mails in multiple languages in one request

Page 31: Multilingual Drupal presentation from "Do it With Drupal"

Language comes to content

Page 32: Multilingual Drupal presentation from "Do it With Drupal"

Associate language to content

As soon as locale module is enabled, content types can be language enabledShows a language selection dropdown for posts when editingAllows for Language neutral posts. Applicable when content is not attached to any languageDoes not mean content translation in itselfUse case: blogs, where author posts in different languages, but these are distinct posts on one site

Page 33: Multilingual Drupal presentation from "Do it With Drupal"

Associate language to contentSetting up the Page content type

Creating new Page content

Page 34: Multilingual Drupal presentation from "Do it With Drupal"

Consequences

Post will have URL with language speci!c part included (domain, path pre!x), if set upThe associated language can be used to create views, export in feeds, etc.Even if you only have a single language site, if translation ever becomes a requirement, better to have posts in the system already marked

Page 35: Multilingual Drupal presentation from "Do it With Drupal"

Translate content

Page 36: Multilingual Drupal presentation from "Do it With Drupal"

The content translation module

Once the Content translation (core) module is enabled, a new language option is available

Page 37: Multilingual Drupal presentation from "Do it With Drupal"

Translation functionality is exposed

Page 38: Multilingual Drupal presentation from "Do it With Drupal"

Title and body pre!lled for translation

Translation links on each post.

Add Hungarian translation for Hebrew post.

Page 39: Multilingual Drupal presentation from "Do it With Drupal"

Each translation is a different node

Great, so that you can have different work#ows for these nodes (eg. publish only if all translations are done)These can have different authors, updated times, permissions, comments in the given language, can show up in different feeds, and so onSets of nodes belonging to the same set are called a translation setVoting, #agging, etc. is supported on the set level as well in contributed modules

Page 40: Multilingual Drupal presentation from "Do it With Drupal"

Basic work#ow support in core

The source node of the translation set can be set to be changed signi!cantly, marking translations outdatedThe translations can then be updated to re#ect the change

On the source post:

Page 41: Multilingual Drupal presentation from "Do it With Drupal"

Basic work#ow support in core

On a translation. Uncheck if not true anymore.

Page 42: Multilingual Drupal presentation from "Do it With Drupal"

So far so long for Drupal 6 core itself

Page 43: Multilingual Drupal presentation from "Do it With Drupal"

Review of the runtime architecture

Page 44: Multilingual Drupal presentation from "Do it With Drupal"

Drupal 6 cannot translate

Site settingsTaxonomy (vocabularies, terms)User de!ned menus (menus, items)Aggregator categoriesPro!le !eld titles and categoriesContent type propertiesBlocksNode lists!

Page 45: Multilingual Drupal presentation from "Do it With Drupal"

So look for contributed modules to add on

Page 46: Multilingual Drupal presentation from "Do it With Drupal"

Interface translation tweaks

Page 47: Multilingual Drupal presentation from "Do it With Drupal"

String overrides

http://drupal.org/project/stringoverridesReplace text available for interface translationLess resource intensive then locale moduleOverride in any language on Drupal 6Will only override the concrete strings speci!ed

Page 48: Multilingual Drupal presentation from "Do it With Drupal"

String overrides

Page 49: Multilingual Drupal presentation from "Do it With Drupal"

Localization client

http://drupal.org/project/l10n_clientDrupal 6 allows collecting strings used on the pageTool built on top of that to translate strings while you walk around pagesCan share translations to a central Localization server while you submit themWorks on non-English pages, if people have permission to do it

Page 50: Multilingual Drupal presentation from "Do it With Drupal"

Localization client

Page 51: Multilingual Drupal presentation from "Do it With Drupal"

Localization server

http://drupal.org/project/l10n_serverMaking interface translation for language groups a lot easierThe intent is to move from CVS and drupal.org project management to a web applicationTranslation sharing, support for packagingCan receive translations from Localization clientUses http://drupal.org/project/potx (Translation template extractor)

Page 52: Multilingual Drupal presentation from "Do it With Drupal"

Web service based content translation

Page 53: Multilingual Drupal presentation from "Do it With Drupal"

Google translate

http://drupal.org/project/gtransGoogle operates an online translation serviceThis module just passes text through that service via their normal web interfaceThe output is wrapped, so users don’t see it going through GoogleSome caveats–Not legal, mentioned to highlight the concept–Does not work for logged-in users–Not well supported, no Drupal 6 version

Page 54: Multilingual Drupal presentation from "Do it With Drupal"

Translatable comments

http://drupal.org/project/translatablecommentsUses Google AJAX Translation API (legal)Completely JavaScript basedUses a !xed set of languages

Original comment:

Translated to French:

Page 55: Multilingual Drupal presentation from "Do it With Drupal"

Machine translation is hard (and funny)

Page 56: Multilingual Drupal presentation from "Do it With Drupal"

Machine translation is hard (and funny)

Page 57: Multilingual Drupal presentation from "Do it With Drupal"

Extended content translation work#ow

support

Page 58: Multilingual Drupal presentation from "Do it With Drupal"

Support computer aided humans

Computer Aided Translation (CAT) tools take HTML, Word, etc. documents and allow translation of thoseThey work with a translation memory which pre-translates the textHumans !x the translations, and feed back the new knowledge to the memory (automatically)The translation gets to the originator in HTML, Word document, etc. format

Page 59: Multilingual Drupal presentation from "Do it With Drupal"

XLIFF Tools module example

http://drupal.org/project/xliffXML Localisation Interchange File Format is a format maintained by OASISSeparates content and formatting in a standard way

Page 60: Multilingual Drupal presentation from "Do it With Drupal"

AWTW module

http://drupal.org/project/awtwAWTW is Automated Web Translation Work#owWorks very similar to XLIFF Tools, but easier to useExports to a custom XML format, which includes source node identi!erAllows you to import translations easily, since it can !nd the original node based on the identi!erNot yet ported to Drupal 6

Page 61: Multilingual Drupal presentation from "Do it With Drupal"

Translation overview

http://drupal.org/project/translation_overviewWorks with the core translation systemModi!es existing Translate tab on nodes

Page 62: Multilingual Drupal presentation from "Do it With Drupal"

Translation overview screen

Page 63: Multilingual Drupal presentation from "Do it With Drupal"

Team work#ow with permissions

http://drupal.org/project/work#owActions and work#ow modules allow you to set up work#ows for translation with states and transitionsWork#ow access supports node level access controlFor example:–Only allow editing of a post until it is “sent for translation”–Send out email to translators then–Only allow translators to edit until set “for review”–Automatically publish when “reviewed”

Page 64: Multilingual Drupal presentation from "Do it With Drupal"

What about content views?

Page 65: Multilingual Drupal presentation from "Do it With Drupal"

Views

http://drupal.org/project/viewsViews supports languages, translation sets and translation status valuesEasily !lter on language or translation set for nodesSort views by languageSet up relations based on translation setsLanguage is only available if translation module enabled - see #343178 for more information

Page 66: Multilingual Drupal presentation from "Do it With Drupal"

Views

Page 67: Multilingual Drupal presentation from "Do it With Drupal"

Views

Page 68: Multilingual Drupal presentation from "Do it With Drupal"

Translate more!

Page 69: Multilingual Drupal presentation from "Do it With Drupal"

Internationalization (i18n) module

Supports multilingual variablesLanguage based listing with extended options for core content listing

Page 70: Multilingual Drupal presentation from "Do it With Drupal"

Settings (variables) translation setupIn your site’s settings.php

Page 71: Multilingual Drupal presentation from "Do it With Drupal"

Site settings (variables) translationOn your site’s user interface.

Page 72: Multilingual Drupal presentation from "Do it With Drupal"

And submodules do a lot more

Page 73: Multilingual Drupal presentation from "Do it With Drupal"

i18nstrings module

Base (API) module for most custom translation toolsImplements strings translation API via the Drupal 6 core provided textgroups systemObject based translation system which almost made it to Drupal 6Other modules like i18nblocks, i18nmenu and i18ntaxonomy use it

Page 74: Multilingual Drupal presentation from "Do it With Drupal"

i18nblocks.module example

Page 75: Multilingual Drupal presentation from "Do it With Drupal"

i18nblocks.module example

Page 76: Multilingual Drupal presentation from "Do it With Drupal"

Share/sync data between translations

Page 77: Multilingual Drupal presentation from "Do it With Drupal"

i18nsync, i18npoll modules

Helps you sync values between content translationsTaxonomy terms, CCK !elds are not shared among nodes in the same translation seti18nsync can sync taxonomy terms and CCK !eld values between set membersi18npoll module will help you aggregate poll results for translations

Page 78: Multilingual Drupal presentation from "Do it With Drupal"

Other contributed modules

The direction is to be able to attach behaviors to both individual nodes and translation setsFlag module for example supports #agging by translation set or by individual nodeCoordinated work going on at the i18n group http://groups.drupal.org/node/15064

Page 79: Multilingual Drupal presentation from "Do it With Drupal"

Look at your own requirements

Page 80: Multilingual Drupal presentation from "Do it With Drupal"

Look at your own requirements

People meet lots of different requirementsYou need to build your own solution according to that and adapt what is there to evolving needsThere are a lot more multilingual options beyond what I could cover in this session, so keep exploringhttp://drupal.org/project/Modules/category/97

Page 81: Multilingual Drupal presentation from "Do it With Drupal"

Questions?

Page 82: Multilingual Drupal presentation from "Do it With Drupal"

ThanksGábor Hojtsy

[email protected] Inc., http://acquia.com/