SlideShare a Scribd company logo
Multilingual Drupal 7

    Drupal Camp ZP
About Me
Pavel Makhrinsky
Drupal Developer in Berlingske Media
http://drupal.org/user/773216

•
Multilingual types
• Localized
Single language site
• Multilingual site
Site with different content for different languages
• Multilingual site with translation
Site with translated content
•
Translatable items
                                 Strings
                                 Menus
                                 Content


Variables

                                 Entities
Configuration
• Core modules
    – Locale
    – Content translate
• Custom modules
    – i18n (Internalization)
    – l10n (Localization helper modules)
    – Entity translation
•
•
Language handling
Language detection
User interface translation



Locale
Locale: languages
  admin/config/regional/language
Locale: language detection
   admin/config/regional/language/configure
Locale: string translation
localize.drupal.org
Localization client
Localization server
Localization update

Community translations
localize.drupal.org
Translation update workflow
Language types
• Interface language
          – t()
          – format_plural()
• Content language *
          – Used for Field API
          – Used for content translation
• URL language *
          – l()
•
Not configurable by core
t(), format_plural()
Context



Translating strings
t(): variations
• t()
if your code will never run during the Drupal installation phase
• st()
if your code will only run during installation and never any other
time
• get_t()
if your code could run in either circumstance
t(): calling
Parameters
• $string
• $args
     – @argument – processed via check_plain()
     – %argument – processed via drupal_placeholder()
     – !argument – inserted as is.
• $options
     – context – context for string
     – langcode – language code, default current
         language
t(): examples
format_plural(): parameters
Parameters
• $count
• $singular
• $plural
• $args
      – @argument – processed via check_plain()
      – %argument – processed via drupal_placeholder()
      – !argument – inserted as is.
• $options
      – context – context for string
      – langcode – language code, default current language
format_plural(): russian
• Add configuration to .po file
"Plural-Forms: nplurals=3; plural=((((n%10)==1)&&((n%100)!=11))?" "(0):(((((n
%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));"

• Add translation
msgid "1 comment"
msgid_plural "@count comments"
msgstr[0] "@count комментарий"
msgstr[1] "@count комментария"
msgstr[2] "@count[2] комментариев"
format_plural(): examples
Context
• The way to describe string
• Works for
      –    t()
      –    format_plural()
      –    Drupal.t()
      –    Drupal.formatPlural()


             Drupal 6                      Drupal 7
                                               Представления
                  Представления    Views
   Views     ?                                 Просмотры
                  Просмотры
JavaScript
• Drupal.t()
1 // Drupal 7.10+
2 shortMay = Drupal.t('May');
3 longMay = Drupal.t('May', {}, {context: "Long month name"});
4
5 // Drupal 7.9-
6 shortMay = Drupal.t('May');
7 longMay = '.... not possible in JS ....';



• Drupal.formatPlural()
1 var n = 3
2 Drupal.formatPlural(n, '1 comment', '[@count] comments', {},
{context: "Tricky comments"});
Context: examples
Translating nodes
Translating fields

Translating content
Translation types
    Node translation            Field translation


Base                                                       ru
node                                               Title    en
 (ru)
                            Entity                         uk
               Node       (default language)

                (en)                                       ru

                                                   Body     en

Node                    Price              Photo
                                                           uk

 (uk)                   (und)              (und)
Node translation: configuration
                     Modules
• Modules:
     – Locale
     – Content translation
• Additional modules:
     – Internalization
     – Multilingual content
     – Multilingual select
     – Synchronize translations
     – Translation redirect
Node translation: configuration
           Content type
Node translation: configuration
      i18n: Multilingual content
Node translation: translation
Node translation: configuration
       i18n: Multilingual select
Node translation: configuration
       i18n: Multilingual select
Entity translation: configuration
                      Modules
• Modules:
     – Locale
     – Entity translation
• Additional modules:
     – Title
•
Entity translation: configuration
             Settings
Entity translation: configuration
           Node creation
The ways
i18n
Usage of context

Menu
Internalization: Menu translation
Separate menus

  English                                         Russian

                Node                    Node
Node item       (en)                     (ru)    Node item




                            Link
Menu router               (home,                Menu router
   item                default pages)              item
One menu, content translation

Node item    Node item    Menu router
In English   In Russian      item




  Node         Node            Link
  (en)          (ru)         (home,
                          default pages)
One menu, entity translation
       Node item
                       Menu router
        Localized
                          item
    Language neutral



         Node               Link
         (en)             (home,
                       default pages)
Menu: adding context
 1 function multilingual_menu() {
 2   $items = array();
 3
 4   $items['yabadabadu'] = array(
 5      'page callback' => 'multilingual_yabadabadu_page',
 6      'access callback' => TRUE,
 7      'type' => MENU_NORMAL_ITEM,
 8      'menu_name' => 'main-menu',
 9
10      'title' => 'Ya-ba-da-ba-du !test',
11      'title callback' => 'multilingual_title_callback',
12      'title arguments' => array(),
13   );
14
15   return $items;
16 }

1 function multilingual_title_callback() {
2   return t('Overwritten !test',
3            array('!test' => 'ya-ba-da-ba-du'),
4            array('context' => 'Multilingual')
5   );
6 }
Menu: adding context
Blocks
Variables
Field properties

Miscellanious items
Block: Block languages
Variables: Variable translation
Field settings: Field translation
Localization update
Localization client
Translation overview

Useful Modules
Localization update
Localization client
Translation overview
Links
•   http://hojtsy.hu/files/Drupal7TranslationCheatSheetv2.pdf
•   http://hojtsy.hu/multilingual-drupal7
•   http://api.drupal.org/api/drupal/includes!common.inc/group/sanit
•   http://api.drupal.org/api/drupal/modules!field!field.multilingual.in
•
Questions?


  Pavel Makhrinsky
  Skype: gumanista

More Related Content

PPTX
Drupal 8 migrate!
PDF
Drupal Render API
PDF
Drupal Field API. Practical usage
PDF
Field api.From d7 to d8
PPTX
Drupal 8 migrate!
PDF
The Beauty and the Beast
PDF
jQuery secrets
PDF
Php unit the-mostunknownparts
Drupal 8 migrate!
Drupal Render API
Drupal Field API. Practical usage
Field api.From d7 to d8
Drupal 8 migrate!
The Beauty and the Beast
jQuery secrets
Php unit the-mostunknownparts

What's hot (20)

PDF
The Beauty And The Beast Php N W09
KEY
Lithium Best
PDF
The IoC Hydra - Dutch PHP Conference 2016
PDF
PHP 5.3 Overview
PDF
Advanced Querying with CakePHP 3
PDF
Current state-of-php
PPT
Quebec pdo
ODP
Rich domain model with symfony 2.5 and doctrine 2.5
PPT
Php course-in-navimumbai
PDF
Introduction to the Pods JSON API
PPTX
Speed up your developments with Symfony2
PDF
Declarative Internal DSLs in Lua: A Game Changing Experience
PDF
Rich Model And Layered Architecture in SF2 Application
KEY
Apache Velocity 1.6
PDF
Doctrine fixtures
PDF
Forget about index.php and build you applications around HTTP!
PDF
Undercover Pods / WP Functions
PDF
SPL: The Missing Link in Development
PDF
Drupal 8: Entities
PDF
PHP Language Trivia
The Beauty And The Beast Php N W09
Lithium Best
The IoC Hydra - Dutch PHP Conference 2016
PHP 5.3 Overview
Advanced Querying with CakePHP 3
Current state-of-php
Quebec pdo
Rich domain model with symfony 2.5 and doctrine 2.5
Php course-in-navimumbai
Introduction to the Pods JSON API
Speed up your developments with Symfony2
Declarative Internal DSLs in Lua: A Game Changing Experience
Rich Model And Layered Architecture in SF2 Application
Apache Velocity 1.6
Doctrine fixtures
Forget about index.php and build you applications around HTTP!
Undercover Pods / WP Functions
SPL: The Missing Link in Development
Drupal 8: Entities
PHP Language Trivia
Ad

Viewers also liked (19)

PPT
Survival
PPTX
Photography Presentation
PPTX
IAP&IAB Cash Testing
PPT
Revistă bibliografică: Suveranitatea, Independență, Democrație și Libertate
PPTX
Visually impaired
PPT
Techpetually speaking: How Tech is Transforming the Pet Industry
PPTX
Tajuk sejarah spm 2012
DOCX
Hoja de vida corporativa
PPT
Asic pd
PPT
множественное число существительных
PPT
Mnozhestvennoe chislo
PPTX
Морфология древнерусского языка
PPTX
plurals
PPTX
Baking & Pastry - Bread Making Process
PPTX
Presentation.ai
PPT
Bahasa Malaysia Kertas 1(Teknik Menjawab)
PDF
A Basic Modern Russian Grammar
PPSX
Singular & Plural Nouns
PPT
Singular and plural nouns ppt
Survival
Photography Presentation
IAP&IAB Cash Testing
Revistă bibliografică: Suveranitatea, Independență, Democrație și Libertate
Visually impaired
Techpetually speaking: How Tech is Transforming the Pet Industry
Tajuk sejarah spm 2012
Hoja de vida corporativa
Asic pd
множественное число существительных
Mnozhestvennoe chislo
Морфология древнерусского языка
plurals
Baking & Pastry - Bread Making Process
Presentation.ai
Bahasa Malaysia Kertas 1(Teknik Menjawab)
A Basic Modern Russian Grammar
Singular & Plural Nouns
Singular and plural nouns ppt
Ad

Similar to Multilingual drupal 7 (20)

PDF
Multilingual Content in Drupal 7 & 8 at DrupalCon Munich
PDF
Multilingual Content: Presentation from DrupalCamp Montreal 2012
PDF
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
PPT
Drupal entity translation
PPTX
JavaOne 2012 - CON11234 - Multi device Content Display and a Smart Use of Ann...
PDF
Barcelona Multilanguage
PDF
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
PDF
Grigory naumovets.multilingual sites.drupal camp kyiv 2011
PDF
i18n for Plugin and Theme Developers, Global WordPress Translation Day 3
PPT
Drupal7 multilingual
PDF
PIL - A Platform Independent Language
PDF
Translating Qt Applications
PPT
PDF
i18n for Plugin and Theme Developers, WordCamp Milano 2016
PDF
A whole new world for multilingual sites in Drupal 8 - jam's Drupal Camp session
PDF
Multilingual Improvements for Drupal 8
PDF
TI1220 Lecture 14: Domain-Specific Languages
PDF
Drupal 8's Multilingual APIs: Building for the Entire World
PDF
Everything multilingual in Drupal 8 (2015 November)
PDF
Drupal 8 multilingual APIs
Multilingual Content in Drupal 7 & 8 at DrupalCon Munich
Multilingual Content: Presentation from DrupalCamp Montreal 2012
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Drupal entity translation
JavaOne 2012 - CON11234 - Multi device Content Display and a Smart Use of Ann...
Barcelona Multilanguage
Grigory Naumovets.Multilingual sites.DrupalCamp Kyiv 2011
Grigory naumovets.multilingual sites.drupal camp kyiv 2011
i18n for Plugin and Theme Developers, Global WordPress Translation Day 3
Drupal7 multilingual
PIL - A Platform Independent Language
Translating Qt Applications
i18n for Plugin and Theme Developers, WordCamp Milano 2016
A whole new world for multilingual sites in Drupal 8 - jam's Drupal Camp session
Multilingual Improvements for Drupal 8
TI1220 Lecture 14: Domain-Specific Languages
Drupal 8's Multilingual APIs: Building for the Entire World
Everything multilingual in Drupal 8 (2015 November)
Drupal 8 multilingual APIs

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Approach and Philosophy of On baking technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
KodekX | Application Modernization Development
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
MYSQL Presentation for SQL database connectivity
Review of recent advances in non-invasive hemoglobin estimation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Approach and Philosophy of On baking technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25 Week I
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Understanding_Digital_Forensics_Presentation.pptx
KodekX | Application Modernization Development

Multilingual drupal 7