SlideShare a Scribd company logo
Parler en plusieurs langues avec Drupal
Bogdan Herea
Zsolt Tasnadi
l About us
l Before we start building a site
l Translating code
l Variables and settings
l Translating user entered content
l Translating taxonomies
l Translating media
l Other tips and tricks
l Conclusions
Summary
About me
Bogdan Herea- Founder & CEO
- 18 years of professional IT experience in
France, Belgium & Romania
- Obtained in 1998 his Engineering Degree at
INSA Lyon, France
- 8 years of IT Management, prior to founding
PITECH+PLUS
- Commercial & strategic spearhead, and
mentor for middle & top-management
PITECH+PLUS is a European software
business started in Cluj-Napoca, Romania
Key Facts
- Founded in 2005
- 120 Employees
- 12 spoken languages
- Offices: Berlin, Paris, Brussels,
Bucharest, Prague.
Strategic Markets
- Healthcare
- Governmental (incl. International)
- Advertising agencies
- Public Companies
- Start-ups
Our expertise contributed to the
success of famous brands – Part 1
Our expertise contributed to the
success of famous brands – Part 2
TECH OVERVIEW
Before we start a site
l How many languages will the site have?
l Enable the languages
l Decide which to use:
l  content translation vs entity translation
l Download, install the core and contribution
modules for translations
Before we start the site
!TIP: Use the default English language only as source!
To be changed in Drupal 8
Install en-us or en-gb for English and use those
for displaying content.
Use string overrides module only if you are sure
you will not have to many exceptions
(Hard to maintain, eating lot of resources)
Before we start the site
Content translation:
l  In core
l  Use it only if you migrating your site from Drupal 6
l  The old way of translation content (a node
for each language)
Entity translation:
l  Supposed to be on core, wasn't finished on time,
core contributors are working on it.
l  Stores the translations in fields
l  You can't translate entity properties with it
l  This is the future, Drupal 8 will have
something similar
Translating code
The t function:
$text = t("@name is presenting a session.",
array('@name' => format_username($account)));
The st function:
$text = st("@name is installing Drupal for a session.",
array('@name' => format_username($account)));
The get_t function:
Use it when can't decide to use t() or st()
$t = get_t();
$text = $t('text to translate.');
Translating code
Context (new from Drupal 7):
print t('Order', array(), array('context' => 'non-commerce-page'));
Because of context, $conf translations shall be declared:
$conf['locale_custom_strings_en'][''] = array(
'ORIGINAL STRING' => 'YOUR STRING',
);
TIP: Don't use variables in t();
Don't: echo t($text_to_translate);
Workaround!
Do like views is exporting labels in features!
Translating code
Format plurals
format_plural($count, '1 category', '@count categories');
Variables placeholder
@variable – check plain applied to the variable
!variable – output the value without filtering it
%variable – Escaped to HTML and formatted
using drupal_placeholder()
Variables and settings
Transliteration module (chars/path) – a must have
Translating variables with i18n_variable (site title)
Translating custom variables (hook_variables_info)
(Variables Table)
Translating custom content with i18n submodules:
l  Block translation
l  Path translation
l  Menu translation
l  Views translation (independent module)
Translating content
Use entity translation for translating nodes
or custom entities.
!TIP: use the title module for nodes, else
node's titles won't be translatable.
Use Title Module
Translating taxonomies
Taxonomy i18n translation – the old way
Taxonomies translated as entities:
l  Use name as machine name
l  Create translatable title field !!!
Translating media?
Don't! Files are referenced by fields, use translation
on the entity reference field.
If you are using entity translation for files:
l  Problems with field_get_items and entity
metadata wrappers;
l  Workaround (not recommended):
/**
* Implements hook_entity_TYPE_load().
*/
function mymodule_entity_file_load($entities)
foreach ($entities as $entity) {
$entity->language = language_default('language');
}
}
Other tips and tricks
Other useful modules:
l  Contact translation
l  Translation overview
l  Translation management tool
Other tips:
l  Localization update – synchronizes
the translations automatically instead of
downloading the po files manually
Other tips and tricks
Other tips
Redirect localization update to custom
translation server
/**
* Implements hook_l10n_update_projects_alter().
*/
function mymodule_l10n_update_projects_alter(&$projects) {
$projects['contrib_module]['info'] = array_merge(
$projects['contrib_module']['info'], array(
'l10n server' => $custom_l10n_server',
'l10n url' => $custom_l10n_url,
'l10n path' => $custom_l10n_path,
)
);
}
Conclusions
Translations UI and translation implementation
improved a lot from Drupal 6.
Still lot of work (entity translation in core, entity
properties translation, etc.)
Drupal 8 will get in lots of good stuff, check
Drupal 8 multilingual initiative (D8MI).
 
	
  
	
  
	
  
	
  
	
  
	
  
Questions?

More Related Content

PPTX
Dart PPT.pptx
DSCMESCOE
 
PDF
Drupal 8's Multilingual APIs: Building for the Entire World
Christian López Espínola
 
PDF
IDL to C++11 initial submission presentation
Remedy IT
 
PDF
OntoLex-TEI: Inspiration from Global WordNet
PretaLLOD
 
PDF
Maine Home + Design Published Article
guestd29b5
 
PDF
Closing the Clinical IT Chasm
GuardEra Access Solutions, Inc.
 
PPT
Thisa Customer Presentation Ga
GuardEra Access Solutions, Inc.
 
ZIP
Homeless In Philadelphia
cwilliams123
 
Dart PPT.pptx
DSCMESCOE
 
Drupal 8's Multilingual APIs: Building for the Entire World
Christian López Espínola
 
IDL to C++11 initial submission presentation
Remedy IT
 
OntoLex-TEI: Inspiration from Global WordNet
PretaLLOD
 
Maine Home + Design Published Article
guestd29b5
 
Closing the Clinical IT Chasm
GuardEra Access Solutions, Inc.
 
Thisa Customer Presentation Ga
GuardEra Access Solutions, Inc.
 
Homeless In Philadelphia
cwilliams123
 

Similar to Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013 (20)

PPT
Babel and Beyond - Professional Multilingual Solutions with Drupal
Acquia
 
PDF
Drupal 8 Multilingual - what to look forward to
Gábor Hojtsy
 
PDF
Everything multilingual in Drupal 8 (2015 November)
Gábor Hojtsy
 
PDF
Multilingual Drupal presentation from "Do it With Drupal"
Gábor Hojtsy
 
PPTX
Drupal 8 customized checkout system
Ahmad Hassan
 
ODP
Multilingual drupal 7
Pavel Makhrinsky
 
PDF
Managing Translation Workflows in Drupal 7
Suzanne Dergacheva
 
PDF
A whole new world for multilingual sites in Drupal 8 - jam's Drupal Camp session
Jeffrey McGuire
 
PDF
Barcelona Multilanguage
guest3a6661
 
PDF
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Suzanne Dergacheva
 
PDF
Multilingual Improvements for Drupal 8
Acquia
 
PDF
Multilingual Drupal
Gábor Hojtsy
 
PPTX
Building Multilingual Sites in Drupal 7 by Yoni Steingiesser
Jonathan Steingiesser
 
PPTX
Drupalcamp Atlanta 2010 Internationalization Presentation
Mediacurrent
 
PDF
Drupal 8 customized checkout system
Ahmad Hassan
 
KEY
Drupal Internationalization
Helior Colorado
 
KEY
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Suzanne Dergacheva
 
PDF
Building Multilingual Websites with Drupal (DrupalCamp Brighton)
Cogapp
 
PDF
Building multilingual websites with drupal
Sam Murray
 
PDF
Managing Drupal interface translation
LimoenGroen
 
Babel and Beyond - Professional Multilingual Solutions with Drupal
Acquia
 
Drupal 8 Multilingual - what to look forward to
Gábor Hojtsy
 
Everything multilingual in Drupal 8 (2015 November)
Gábor Hojtsy
 
Multilingual Drupal presentation from "Do it With Drupal"
Gábor Hojtsy
 
Drupal 8 customized checkout system
Ahmad Hassan
 
Multilingual drupal 7
Pavel Makhrinsky
 
Managing Translation Workflows in Drupal 7
Suzanne Dergacheva
 
A whole new world for multilingual sites in Drupal 8 - jam's Drupal Camp session
Jeffrey McGuire
 
Barcelona Multilanguage
guest3a6661
 
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Suzanne Dergacheva
 
Multilingual Improvements for Drupal 8
Acquia
 
Multilingual Drupal
Gábor Hojtsy
 
Building Multilingual Sites in Drupal 7 by Yoni Steingiesser
Jonathan Steingiesser
 
Drupalcamp Atlanta 2010 Internationalization Presentation
Mediacurrent
 
Drupal 8 customized checkout system
Ahmad Hassan
 
Drupal Internationalization
Helior Colorado
 
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Suzanne Dergacheva
 
Building Multilingual Websites with Drupal (DrupalCamp Brighton)
Cogapp
 
Building multilingual websites with drupal
Sam Murray
 
Managing Drupal interface translation
LimoenGroen
 
Ad

Recently uploaded (20)

PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PPTX
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
DOCX
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
PDF
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
PDF
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PPTX
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
Artificial-Intelligence-in-Drug-Discovery by R D Jawarkar.pptx
Rahul Jawarkar
 
An introduction to Dialogue writing.pptx
drsiddhantnagine
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
Modul Ajar Deep Learning Bahasa Inggris Kelas 11 Terbaru 2025
wahyurestu63
 
The Minister of Tourism, Culture and Creative Arts, Abla Dzifa Gomashie has e...
nservice241
 
Module 2: Public Health History [Tutorial Slides]
JonathanHallett4
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
Cleaning Validation Ppt Pharmaceutical validation
Ms. Ashatai Patil
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
family health care settings home visit - unit 6 - chn 1 - gnm 1st year.pptx
Priyanshu Anand
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
Ad

Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013

  • 1. Parler en plusieurs langues avec Drupal Bogdan Herea Zsolt Tasnadi
  • 2. l About us l Before we start building a site l Translating code l Variables and settings l Translating user entered content l Translating taxonomies l Translating media l Other tips and tricks l Conclusions Summary
  • 3. About me Bogdan Herea- Founder & CEO - 18 years of professional IT experience in France, Belgium & Romania - Obtained in 1998 his Engineering Degree at INSA Lyon, France - 8 years of IT Management, prior to founding PITECH+PLUS - Commercial & strategic spearhead, and mentor for middle & top-management
  • 4. PITECH+PLUS is a European software business started in Cluj-Napoca, Romania Key Facts - Founded in 2005 - 120 Employees - 12 spoken languages - Offices: Berlin, Paris, Brussels, Bucharest, Prague. Strategic Markets - Healthcare - Governmental (incl. International) - Advertising agencies - Public Companies - Start-ups
  • 5. Our expertise contributed to the success of famous brands – Part 1
  • 6. Our expertise contributed to the success of famous brands – Part 2
  • 8. Before we start a site l How many languages will the site have? l Enable the languages l Decide which to use: l  content translation vs entity translation l Download, install the core and contribution modules for translations
  • 9. Before we start the site !TIP: Use the default English language only as source! To be changed in Drupal 8 Install en-us or en-gb for English and use those for displaying content. Use string overrides module only if you are sure you will not have to many exceptions (Hard to maintain, eating lot of resources)
  • 10. Before we start the site Content translation: l  In core l  Use it only if you migrating your site from Drupal 6 l  The old way of translation content (a node for each language) Entity translation: l  Supposed to be on core, wasn't finished on time, core contributors are working on it. l  Stores the translations in fields l  You can't translate entity properties with it l  This is the future, Drupal 8 will have something similar
  • 11. Translating code The t function: $text = t("@name is presenting a session.", array('@name' => format_username($account))); The st function: $text = st("@name is installing Drupal for a session.", array('@name' => format_username($account))); The get_t function: Use it when can't decide to use t() or st() $t = get_t(); $text = $t('text to translate.');
  • 12. Translating code Context (new from Drupal 7): print t('Order', array(), array('context' => 'non-commerce-page')); Because of context, $conf translations shall be declared: $conf['locale_custom_strings_en'][''] = array( 'ORIGINAL STRING' => 'YOUR STRING', ); TIP: Don't use variables in t(); Don't: echo t($text_to_translate); Workaround! Do like views is exporting labels in features!
  • 13. Translating code Format plurals format_plural($count, '1 category', '@count categories'); Variables placeholder @variable – check plain applied to the variable !variable – output the value without filtering it %variable – Escaped to HTML and formatted using drupal_placeholder()
  • 14. Variables and settings Transliteration module (chars/path) – a must have Translating variables with i18n_variable (site title) Translating custom variables (hook_variables_info) (Variables Table) Translating custom content with i18n submodules: l  Block translation l  Path translation l  Menu translation l  Views translation (independent module)
  • 15. Translating content Use entity translation for translating nodes or custom entities. !TIP: use the title module for nodes, else node's titles won't be translatable. Use Title Module
  • 16. Translating taxonomies Taxonomy i18n translation – the old way Taxonomies translated as entities: l  Use name as machine name l  Create translatable title field !!!
  • 17. Translating media? Don't! Files are referenced by fields, use translation on the entity reference field. If you are using entity translation for files: l  Problems with field_get_items and entity metadata wrappers; l  Workaround (not recommended): /** * Implements hook_entity_TYPE_load(). */ function mymodule_entity_file_load($entities) foreach ($entities as $entity) { $entity->language = language_default('language'); } }
  • 18. Other tips and tricks Other useful modules: l  Contact translation l  Translation overview l  Translation management tool Other tips: l  Localization update – synchronizes the translations automatically instead of downloading the po files manually
  • 19. Other tips and tricks Other tips Redirect localization update to custom translation server /** * Implements hook_l10n_update_projects_alter(). */ function mymodule_l10n_update_projects_alter(&$projects) { $projects['contrib_module]['info'] = array_merge( $projects['contrib_module']['info'], array( 'l10n server' => $custom_l10n_server', 'l10n url' => $custom_l10n_url, 'l10n path' => $custom_l10n_path, ) ); }
  • 20. Conclusions Translations UI and translation implementation improved a lot from Drupal 6. Still lot of work (entity translation in core, entity properties translation, etc.) Drupal 8 will get in lots of good stuff, check Drupal 8 multilingual initiative (D8MI).
  • 21.               Questions?