• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Drupal7 multilingual
 

Drupal7 multilingual

on

  • 12,973 views

Multilingual sites in Drupal 7: New features, new possibilities

Multilingual sites in Drupal 7: New features, new possibilities
by Grigory Naumovets
(A presentation ar DrupalCamp Kyiv, June 3-4, 2011)

Statistics

Views

Total Views
12,973
Views on SlideShare
12,852
Embed Views
121

Actions

Likes
10
Downloads
0
Comments
0

4 Embeds 121

http://gn.org.ua 97
http://n3.localhost 12
http://www.ralf-henze.de 11
http://gn.localhost 1

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Drupal7 multilingual Drupal7 multilingual Presentation Transcript

    • Multilingual sites in Drupal 7: New features, new possibilities Grigory Naumovets Kiev, Ukraine
    • Outline
      • Support of multilingual content in Drupal: an overview
      • New multilingual features in D7 core
      • New multilingual features in D7 versions of contributed modules (i18n etc.)
      • Summary of most important improvements in multilingual functionality
      • Problems and prospects
    • It’s a followup presentation to:
      • Multilingual sites in Drupal : Problems, solutions, workarounds, and “goodness on the way”
      • (DrupalCamp Kyiv 2009)
      • www.slideshare.net/Tinnka/multilanguage-drupal
      • gn.org.ua/drupal/presentations/DrupalCamp_2009-2010
      • 2009 ----> 2011:
      • Has anything essential changed with the release of Drupal 7?
      • Is “multilingual goodness” already approaching, or still on the way?
    • What is ”i18n” and ”L10n”?
      • i nternationalizatio n  i18n
      18 letters omitted 10 letters omitted L ocalizatio n  L10n These abbreviations are used in the names of Drupal modules, such as “i18n” or “L10n_client”
    • If Drupal nodes were designed as multilingual from the very beginning …
      • node/1
      • (multilingual)
      Title (lang1) Title (lang2) Body (lang1) Body (lang2) Some field (lang1) Some field (lang2) Another field (language-neutral) Some file attached (lang1) Some file attached (lang2) Another file attached (language-neutral) comments
    • However, Drupal nodes are unilingual . i18n is an external feature.
      • node/1 (unilingual) lang1
      Some file attached Another file attached node/2 (unilingual) lang2 Some file attached Another file attached Drupal i18n system: I hereby declare node/1 and node/2 to be translations of each other comments comments Title Body Some field Another field Title Body Some field Another field
    • Multilanguage: inside or outside?
      • Two possible approaches to i18n:
      • Multilingual features inside an object
      • Unilingual object, multilanguage features are applied from outside as a system of connections to other objects
      • “ Object” can be a node, a block, a taxonomy term, a menu, a menu item, and so on.
    • Inside vs outside
      • Drupal uses both approaches (depending on the object type), so improvements of multilang support proceed in two ways:
        • Making objects “more multilingual”
        • Improving the system of i18n-related connections between unilingual objects
      • Each approach has its advantages and difficulties
      • Until recently, approach to nodes was only “from outside”
      • Some problems caused by this approach will be demonstrated below
    • No field-level language attributes: Why it can be a problem? Example 1
      • node/1 lang1
      Image field node/2 lang2 Image field translation synchronization Title Body Title Body
    • No field-level language attributes: Why it can be a problem? Example 2
      • You need to synchronize nodereferences
      • (i18nsync)
      node/3 (en) event info node/4 (ru) event info node/1 (en) location info node/2 (ru) location info translation translation nodereference nodereference
    • Problem with multilingual views based on nodereference
      • ru/events/by-location/ Распределение со бытий по месту проведения:
        • Киев (6)
        • Кишинёв (4)
      ru/events/by-location/37 Список событий в Кишинёве
      • en/events/by-location/ Events grouped by locations :
        • Kiev (6)
        • Chişinău (4)
      en/events/by-location/36 List of events in Chişinău “ Chişinău ” (node/36) and “ Кишинёв ” (node/37) are different nodes, so when you switch language EN -> RU while viewing the “ List of events in Chişinău ” you will see an empty list instead of “ Список событий в Кишинёве ” . en  ru en  ru
    • Inside vs outside
      • However, the “outside” approach can have some advantages, too
        • It can be simpler to do or maintain
        • It can utilize such node-level things as access permissions for nodes having certain attributes (e.g. when you have different people working with nodes in different languages), and so on
      • It’s highly desirable to have both possibilities, and choose between them depending on the specific situation.
    • Now, let us look at the D7 core
      • Modules included in D7 core (same as for D6):
        • Content Translation
        • Locale
      • ( disabled by default )
    • Site configuration settings: “ Regional and Language ” section
      • Available after enabling the “ Locale ” module
    • Regional settings
      • New in D7:
      • Now you can set “Default country” (to be used by contributed modules)
      • More intelligent time zone handling (with PHP 5.2+ DateTime objects )
    • Date and time settings
      • More control over date and time format
    • Configuration of Languages: Detection and selection
      • New in D7:
      • Finer control over language detection and selection
      • We can set order of priorities
    • Interface translation
      • New in D7:
      • Improved user interface
      • Support for context
    • Contexts are intended for per-meaning translatability Context: “May” as Long month name ( not “may be”) Context is a new feature; guidelines still need to be developed. So far, used inconsistently. Not supported by Javascript menu items and strings.
    • Localization auto-update
      • Localization update module by Jose Reyero ( L10n_update )
      • Works similarly to Drupal core update module
      • Downloads translation updates from localize.drupal.org (or from custom depository)
      • Available both for D7 and D6 (v. 7.x-1.0-beta2 and 6.x-1.0-beta1 of 2011-May-31 )
    • “ Cheat sheets” for localizers (“ шпаргалки ”)
      • Drupal 7 localization cheat sheet Drupal 6 localization cheat sheet by Gábor Hojtsy hojtsy.hu/files/Drupal7TranslationCheatSheetv2.pdf hojtsy.hu/files/Drupal6TranslationCheatSheetv2.pdf
    • Now about content translation Enable multilingual support in content type properties: Looking for this in “Publishing options” is not really obvious
    • Now we can control ‘ node.language ’ attribute for nodes of this content type
      • By default, a new node is Language neutral
      New in D7: For language-neutral nodes, database field node.language = ‘und’ ‘ und’ means ‘undetermined’ in compliance with ISO 639
    • Node translation (same as in D6)
      • “ Translate ” tab is seen when:
      • This content type has multilingual support “ Enabled, with translation ”
      • This node is NOT language neutral
      • User is permitted to translate content
    • “ Translation set” (same as in D6)
      • ‘ tnid ’ – translation set id
      • is shared by all nodes in a translation set
      • is equal to ‘nid’ of the base node
      node/1 Base node node.nid=1 node.language=‘ en ’ node.tnid= 1 node/2 Translated node node.nid=2 node.language=‘ uk ’ node.tnid= 1 node/3 Translated node node.nid=3 node.language=‘ ru ’ node.tnid= 1
    • And now something really new… We need to use some contributed modules However, D7 has NO built-in interface for translatable fields  D7 core has built-in support for field languages!!! (via its new Field API) 
    • Entity_translation module
      • Can be used to translate fields
      New item in “Regional and language settings” – “Entity translation”
    • Entity translation
      • Field settings: “Users may translate this field”
      New option for multilingual support in content type properties
    • Single node with multilingual body and other fields: wow, it [almost] works!
      • Node title is a different kind of field and cannot be translated this way!!!
      example.com/uk/node/1 example.com/node/1
    • ‘ Title’ module: replace node title with a regular field
    • Single node with multilingual body and other fields: now the title can be translated, too!
      • Node title is now replaced with a regular field using ‘Title’ module
      example.com/uk/node/1 example.com/node/1
    • Entity_translation + Title: is this already the “multilingual field goodness”?
      • These modules are very recent, still at the ‘dev’ stage (v. 7.x-1.x-dev )
      • As of June 2, 2011,
        • 130 sites currently report using ‘Entity_translation’
        • 59 sites currently report using ‘Title’
      • Still quite a lot of todo’s
      • We need to test its interactions with views. taxonomy, paths, and so on.
    • Now about the i18n.module
      • Q: Can I build a multilingual site using only the core D7 functionality?
      • A: A very simple site – yes, but for more complex things you’ll need the i18n.module. i18n helps you handle multilingual blocks, menus, views, synchronization of items between nodes, and so on.
    • Enabling multilingual variables in i18n/D6: add their names ( site_name , site_footer , theme_settings , etc.) to the settings.php file $conf['i18n_variables'] = array( // Site name, slogan, mission, etc.. 'site_name', 'site_slogan', 'site_mission', 'site_footer', 'anonymous', // Different front page for each language 'site_frontpage', // Primary and secondary links 'menu_primary_links_source', 'menu_secondary_links_source', // Contact form information 'contact_form_information', // For theme variables, read more below 'theme_settings', 'theme_garland_settings', );
    • i18n/D7 does not work this way anymore Now multilingual variables are controlled via “Multilingial settings – Variables” menu (Depends on the new variable.module )
    • Multilingual variables A very convenient link to switch languages (especially if there is no language switcher in the admin theme)
    • New in D7 and important: Translation set API
      • (i18n_translation.module)
      • Now we can create translation sets not only for nodes, but for other things, too:
        • taxonomy terms
        • menu items
        • paths
      • Not implemented yet for blocks
    • Taxonomy terms Connect different terms as translations of each other: This option was available in D6, too – but it did not really work. Now (I hope) it should!
    • New: Path translation (i18n_path.module)
      • Intended for translation of generic paths that don't have other way of being translated.
      • From any of these pages, the language switcher will point to the other path for each language.
      • Note: path translations must be defined without aliases.
    • Menu translation
      • Thanks to Translation set API, now we can translate menu items pointing to specific nodes, e.g.: (en) -> node/1 (uk) -> node/2
    • Blocks
      • Translation sets not working for Blocks yet(?)
      • Improved UI and visibility options
      • Block can be translated via string translation
    • Other improvements in i18n
      • More options and improved UI for content selection and filtering by language
      • More items can be synchronized between translation set nodes (because more items are available as Fields)
      • Translation redirect (i18n_redirect.module): redirect to translated path when available (SEO optimization)
      • Contact form translation (i18n_contact.module) – recently added
    • Berlin Internationalization sprint (May 11-15, 2011)
      • i18nsprint.drupalevents.de
      • reyero.net/en/drupal/berlin_internationalization_sprint : “ How i18n got some fresh blood and a sexy facelift ”
      • i18n 7.x-1.0-beta6 (May 24, 2011) includes improvements from Berlin i18n sprint. New features:
        • Consistent translation tabs for objects
        • Contact form translation
    • Summary of most important changes in D7 and i18n/D7
      • D7:
        • Translation of fields within a node (no built-in UI yet, available via recently contributed modules)
      • i18n/D7:
        • Translation sets (connecting taxonomy terms, menu items, paths, etc.)
      • Plus lots of less important improvements in UI, content selection and filtering, etc.
    • References
      • Drupal 7's new multilingual systems compilation by Gábor Hojtsy hojtsy.hu/multilingual-drupal7
      • Drupal 7 Multilingual: What is new in i18n by Suzanne Kennedy evolvingweb.ca/story/drupal-7-multilingual-whats-new-i18n
      • Multilanguage for Drupal 7: Internationalization module (i18n beta1) by Jose Reyero reyero.net/en/drupal/drupal7_i18n_beta1_overview
      • Content Translation (field translation) in Drupal 7: First steps by Randy Fay (read discussions in the comments, too!) randyfay.com/node/88
    • Questions?
      • Contacts:
      • http://camp11.drupal.ua/users/GN
      • [email_address]
      • http://gn.org.ua/feedback