SlideShare a Scribd company logo
DRUPAL 8 MULTILINGUAL
POSSIBILITIES FOR CUSTOMIZED
CHECKOUT SYSTEM
Drupal Camp Munich 12/2016
Ahmad Hassan Sr. Drupal Developer
DRUPAL 8 MULTILINGUAL POSSIBILITIES
● Customized Checkout system
● Translatable Custom Entities
● Multilingual Entity Form
○ Translate Form Authentication
● Twig Translation
● Block and Menu Translation
● Using PO file for additional Translation.
● Core Possibilities.
DRUPAL 8 MULTILINGUAL POSSIBILITIES
Customized Checkout system
● Why it called customized. It has Customized entities, custom blocks, custom
cart… almost everything except drupal8 multilingual core support.
● We have designed a Customized Checkout system with custom Content
Entity.
● We have used mainly three entities for user interaction to submit their
orders.
● Actually for these Entities, we need translation support for atleast five EU
languages.
● We need to translate our forms and information about the order.
● This was my first multilingual site but it was easy to manage in drupal 8.
● To achieve all this we need to follow some simple steps…
Translatable Custom Entities…
- After creating new content entity, we need to declare translatable = TRUE in
Entity annotation. e,g
- Drupal 8 provide Interface to select which fields we need to translate. e,g
-
Translatable Custom Entities…
● Each Field have to define with label/description with t() function.
MULTILINGUAL Entities Form...declaration
● As we have define Entity translatable = True,
We also need to define setTranslatable(TRUE)
Over each Field.
● Strings which does not define in core,
we imported all strings in .po files.
● I have also manage the title of forms to define
With t() funtion in Entity form $form['#title'] = t(“strings”);
MULTILINGUAL Entities Form… Example
MULTILINGUAL Entities Form… Country names list
● We have taken list of countries from some services by sending language-id in
parameter.
● For example if current language is German, I pass ‘de’ and get country names
in German.
● We can get current active language in drupal 8 with language Manager.
$language = Drupal::languageManager()->getCurrentLanguage()->getId();
MULTILINGUAL Entities Form… form validation
● In form validate function, we can override core form validation
● We can simply define string with $this->t() function.
● $form_state->setErrorByName('Field', $this->t("Please Enter your Field"));
MULTILINGUAL with Twig … .twig
● We can also define labels or description strings in twig
file as html.
● And to translate these string we can just use
{% trans %} Please review your order details {% endtrans %}:
● And import those strings for other languages with .po
files.
MULTILINGUAL Custom Block and Menu… form validation
● We can define in visibility, on which languages this block should be visible.
MULTILINGUAL Custom Block and Menu… Blocks
● In drupal 8, we can define a block and than translate them in other language
● We just need to define title and block content separately for each language.
MULTILINGUAL Custom Block and Menu… Blocks
● We can also publish or unpublish each translation and use as other contents.
● As well as we make these translation outdated to use some other. E.g,
MULTILINGUAL Custom Block and Menu… Menu
● Similarly we can define a menu and for each menu element can have
different settings for each language.
MULTILINGUAL Custom Block and Menu… Menu
● We can create different link title, description for different languages.
● We can also publish/unpublish or outdate menu element translation as
blocks.,
Import strings Using .po files… Import
● I have just copied core .po file and remove all the string and add all my
strings and translated string in it.
● Drupal 8 provides import/export feature to update or get all string by
interface.
● So no need to update code for just translation. Just define all with t(),
● Add all strings and translation in .po file and import in related language.
Core Possibilities… settings
● We can install Drupal 8 in any language instead of doing it on later staging.
● In Drupal 8, we can define how current language would be detect, e.g, by Url,
Session, browser, user. Depend upon your settings, Im using Url.
● Custom language settings, where we can see a list of translatable Entities.
Any content type, Entity, user, Profile, custom Entity blocks..
● After Selecting each Entity, we can also select their fields.
● We can also set if these settings should display on view/edit pages.
Core Possibilities… settings
● We can import and export .po files. I have added my strings with .po files, we
can also override in file if already exist.
● The good thing is that once you import all translations you are able to edit
any string by interface.
● So instead of just content translation, we have also list of configuration
settings. And we can translate configuration.
Core Possibilities… Code
● From Entity Obj, we can get translations and then we can get translation of
all fields, e.g,
$translation = $ent->getTranslation(‘de’);
$titles[‘de’] = $translation->title;
● How we can get the lanuage code:
● $language =
Drupal::languageManager()->getCurrentLanguage()->getId();
● To get the language name: $language =
Drupal::languageManager()->getCurrentLanguage()->getName();
Languageicon… contrib module
● This was the only contrib module we have used in our site.
● This module provide a list of flags of enable language.
● It also provide us block. We can make visible any region of our site.
● Only one click on language can change your page to another language
DRUPAL 8 MULTILINGUAL POSSIBILITIES FOR
CUSTOMIZED CHECKOUT SYSTEM
Thanks
Questions

More Related Content

PPTX
Decoupled drupal
Ahmad Hassan
 
PPTX
PHP Variables and scopes
sana mateen
 
PPT
PHP
sometech
 
ODP
Php variables (english)
Mahmoud Masih Tehrani
 
PPT
Control Structures In Php 2
Digital Insights - Digital Marketing Agency
 
PPTX
PHP slides
Farzad Wadia
 
PDF
2018 05-11 the way we teach tech - phpday
Jeroen van der Gulik
 
PPTX
Php Unit 1
team11vgnt
 
Decoupled drupal
Ahmad Hassan
 
PHP Variables and scopes
sana mateen
 
Php variables (english)
Mahmoud Masih Tehrani
 
Control Structures In Php 2
Digital Insights - Digital Marketing Agency
 
PHP slides
Farzad Wadia
 
2018 05-11 the way we teach tech - phpday
Jeroen van der Gulik
 
Php Unit 1
team11vgnt
 

What's hot (20)

ODP
Php1
rajikaa
 
PPS
Web technology html5 php_mysql
durai arasan
 
PPTX
Constructor and encapsulation in php
SHIVANI SONI
 
PPTX
PHP
Steve Fort
 
PDF
PHP Jump Start
Haim Michael
 
PPTX
Php basics
Jamshid Hashimi
 
PPTX
Php
Shyam Khant
 
PPTX
Dev traning 2016 basics of PHP
Sacheen Dhanjie
 
PDF
Php a dynamic web scripting language
Elmer Concepcion Jr.
 
PPTX
Server Scripting Language -PHP
Deo Shao
 
PPSX
PHP Comprehensive Overview
Mohamed Loey
 
PPTX
PHP Basics
Bhaktaraz Bhatta
 
PPT
PHP variables
Siddique Ibrahim
 
PDF
PHP Loops and PHP Forms
M.Zalmai Rahmani
 
PPT
Php mysql
Shehrevar Davierwala
 
DOCX
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
PPT
Class 3 - PHP Functions
Ahmed Swilam
 
PPT
Php(report)
Yhannah
 
PDF
Challenge: convert policy doc from docbook to sphinx
Hideki Yamane
 
Php1
rajikaa
 
Web technology html5 php_mysql
durai arasan
 
Constructor and encapsulation in php
SHIVANI SONI
 
PHP Jump Start
Haim Michael
 
Php basics
Jamshid Hashimi
 
Dev traning 2016 basics of PHP
Sacheen Dhanjie
 
Php a dynamic web scripting language
Elmer Concepcion Jr.
 
Server Scripting Language -PHP
Deo Shao
 
PHP Comprehensive Overview
Mohamed Loey
 
PHP Basics
Bhaktaraz Bhatta
 
PHP variables
Siddique Ibrahim
 
PHP Loops and PHP Forms
M.Zalmai Rahmani
 
PHP NOTES FOR BEGGINERS
Aminiel Michael
 
Class 3 - PHP Functions
Ahmed Swilam
 
Php(report)
Yhannah
 
Challenge: convert policy doc from docbook to sphinx
Hideki Yamane
 
Ad

Similar to Drupal 8 customized checkout system (20)

PPTX
Drupal 8 customized checkout system
Ahmad Hassan
 
PDF
Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
🚀 Bogdan Herea
 
PDF
Drupal 8 Multilingual - what to look forward to
Gábor Hojtsy
 
PDF
Everything multilingual in Drupal 8 (2015 November)
Gábor Hojtsy
 
PPTX
Drupalcamp Atlanta 2010 Internationalization Presentation
Mediacurrent
 
PPTX
Building Multilingual Sites in Drupal 7 by Yoni Steingiesser
Jonathan Steingiesser
 
PDF
Multilingual Improvements for Drupal 8
Acquia
 
PDF
Managing Drupal interface translation
LimoenGroen
 
PPTX
Multi lingual implementations – drupal design approaches for different scenar...
Drupal Camp Delhi
 
PDF
[Hkdug] #20151219 drupal 8 release party - drupal 8 multilingual overview
Francis Yan
 
PPT
Babel and Beyond - Professional Multilingual Solutions with Drupal
Acquia
 
PPTX
Multilingual website in Drupal 8
valuebound
 
PDF
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Suzanne Dergacheva
 
PDF
A whole new world for multilingual sites in Drupal 8 - jam's Drupal Camp session
Jeffrey McGuire
 
PDF
Everything multilingual in Drupal 8
Gábor Hojtsy
 
PDF
Building Multilingual Websites with Drupal (DrupalCamp Brighton)
Cogapp
 
PDF
Building multilingual websites with drupal
Sam Murray
 
PDF
Drupal 8's Multilingual APIs: Building for the Entire World
Christian López Espínola
 
PDF
Multilingual_in_Drupal_8
Luis Rodríguez Castromil
 
PDF
The multilingual Drupal 8 experience (European Drupal Days 2015)
Eugenio Minardi
 
Drupal 8 customized checkout system
Ahmad Hassan
 
Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
🚀 Bogdan Herea
 
Drupal 8 Multilingual - what to look forward to
Gábor Hojtsy
 
Everything multilingual in Drupal 8 (2015 November)
Gábor Hojtsy
 
Drupalcamp Atlanta 2010 Internationalization Presentation
Mediacurrent
 
Building Multilingual Sites in Drupal 7 by Yoni Steingiesser
Jonathan Steingiesser
 
Multilingual Improvements for Drupal 8
Acquia
 
Managing Drupal interface translation
LimoenGroen
 
Multi lingual implementations – drupal design approaches for different scenar...
Drupal Camp Delhi
 
[Hkdug] #20151219 drupal 8 release party - drupal 8 multilingual overview
Francis Yan
 
Babel and Beyond - Professional Multilingual Solutions with Drupal
Acquia
 
Multilingual website in Drupal 8
valuebound
 
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Suzanne Dergacheva
 
A whole new world for multilingual sites in Drupal 8 - jam's Drupal Camp session
Jeffrey McGuire
 
Everything multilingual in Drupal 8
Gábor Hojtsy
 
Building Multilingual Websites with Drupal (DrupalCamp Brighton)
Cogapp
 
Building multilingual websites with drupal
Sam Murray
 
Drupal 8's Multilingual APIs: Building for the Entire World
Christian López Espínola
 
Multilingual_in_Drupal_8
Luis Rodríguez Castromil
 
The multilingual Drupal 8 experience (European Drupal Days 2015)
Eugenio Minardi
 
Ad

Recently uploaded (20)

PDF
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PDF
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PDF
Download iTop VPN Free 6.1.0.5882 Crack Full Activated Pre Latest 2025
imang66g
 
PPTX
Role Of Python In Programing Language.pptx
jaykoshti048
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
PDF
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PDF
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
PPTX
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PPTX
oapresentation.pptx
mehatdhavalrajubhai
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
An Experience-Based Look at AI Lead Generation Pricing, Features & B2B Results
Thomas albart
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Appium Automation Testing Tutorial PDF: Learn Mobile Testing in 7 Days
jamescantor38
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
Download iTop VPN Free 6.1.0.5882 Crack Full Activated Pre Latest 2025
imang66g
 
Role Of Python In Programing Language.pptx
jaykoshti048
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
vAdobe Premiere Pro 2025 (v25.2.3.004) Crack Pre-Activated Latest
imang66g
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
advancepresentationskillshdhdhhdhdhdhhfhf
jasmenrojas249
 
Can You Build Dashboards Using Open Source Visualization Tool.pptx
Varsha Nayak
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
oapresentation.pptx
mehatdhavalrajubhai
 
Protecting the Digital World Cyber Securit
dnthakkar16
 

Drupal 8 customized checkout system

  • 1. DRUPAL 8 MULTILINGUAL POSSIBILITIES FOR CUSTOMIZED CHECKOUT SYSTEM Drupal Camp Munich 12/2016 Ahmad Hassan Sr. Drupal Developer
  • 2. DRUPAL 8 MULTILINGUAL POSSIBILITIES ● Customized Checkout system ● Translatable Custom Entities ● Multilingual Entity Form ○ Translate Form Authentication ● Twig Translation ● Block and Menu Translation ● Using PO file for additional Translation. ● Core Possibilities.
  • 3. DRUPAL 8 MULTILINGUAL POSSIBILITIES Customized Checkout system ● Why it called customized. It has Customized entities, custom blocks, custom cart… almost everything except drupal8 multilingual core support. ● We have designed a Customized Checkout system with custom Content Entity. ● We have used mainly three entities for user interaction to submit their orders. ● Actually for these Entities, we need translation support for atleast five EU languages. ● We need to translate our forms and information about the order. ● This was my first multilingual site but it was easy to manage in drupal 8. ● To achieve all this we need to follow some simple steps…
  • 4. Translatable Custom Entities… - After creating new content entity, we need to declare translatable = TRUE in Entity annotation. e,g - Drupal 8 provide Interface to select which fields we need to translate. e,g -
  • 5. Translatable Custom Entities… ● Each Field have to define with label/description with t() function.
  • 6. MULTILINGUAL Entities Form...declaration ● As we have define Entity translatable = True, We also need to define setTranslatable(TRUE) Over each Field. ● Strings which does not define in core, we imported all strings in .po files. ● I have also manage the title of forms to define With t() funtion in Entity form $form['#title'] = t(“strings”);
  • 8. MULTILINGUAL Entities Form… Country names list ● We have taken list of countries from some services by sending language-id in parameter. ● For example if current language is German, I pass ‘de’ and get country names in German. ● We can get current active language in drupal 8 with language Manager. $language = Drupal::languageManager()->getCurrentLanguage()->getId();
  • 9. MULTILINGUAL Entities Form… form validation ● In form validate function, we can override core form validation ● We can simply define string with $this->t() function. ● $form_state->setErrorByName('Field', $this->t("Please Enter your Field"));
  • 10. MULTILINGUAL with Twig … .twig ● We can also define labels or description strings in twig file as html. ● And to translate these string we can just use {% trans %} Please review your order details {% endtrans %}: ● And import those strings for other languages with .po files.
  • 11. MULTILINGUAL Custom Block and Menu… form validation ● We can define in visibility, on which languages this block should be visible.
  • 12. MULTILINGUAL Custom Block and Menu… Blocks ● In drupal 8, we can define a block and than translate them in other language ● We just need to define title and block content separately for each language.
  • 13. MULTILINGUAL Custom Block and Menu… Blocks ● We can also publish or unpublish each translation and use as other contents. ● As well as we make these translation outdated to use some other. E.g,
  • 14. MULTILINGUAL Custom Block and Menu… Menu ● Similarly we can define a menu and for each menu element can have different settings for each language.
  • 15. MULTILINGUAL Custom Block and Menu… Menu ● We can create different link title, description for different languages. ● We can also publish/unpublish or outdate menu element translation as blocks.,
  • 16. Import strings Using .po files… Import ● I have just copied core .po file and remove all the string and add all my strings and translated string in it. ● Drupal 8 provides import/export feature to update or get all string by interface. ● So no need to update code for just translation. Just define all with t(), ● Add all strings and translation in .po file and import in related language.
  • 17. Core Possibilities… settings ● We can install Drupal 8 in any language instead of doing it on later staging. ● In Drupal 8, we can define how current language would be detect, e.g, by Url, Session, browser, user. Depend upon your settings, Im using Url. ● Custom language settings, where we can see a list of translatable Entities. Any content type, Entity, user, Profile, custom Entity blocks.. ● After Selecting each Entity, we can also select their fields. ● We can also set if these settings should display on view/edit pages.
  • 18. Core Possibilities… settings ● We can import and export .po files. I have added my strings with .po files, we can also override in file if already exist. ● The good thing is that once you import all translations you are able to edit any string by interface. ● So instead of just content translation, we have also list of configuration settings. And we can translate configuration.
  • 19. Core Possibilities… Code ● From Entity Obj, we can get translations and then we can get translation of all fields, e.g, $translation = $ent->getTranslation(‘de’); $titles[‘de’] = $translation->title; ● How we can get the lanuage code: ● $language = Drupal::languageManager()->getCurrentLanguage()->getId(); ● To get the language name: $language = Drupal::languageManager()->getCurrentLanguage()->getName();
  • 20. Languageicon… contrib module ● This was the only contrib module we have used in our site. ● This module provide a list of flags of enable language. ● It also provide us block. We can make visible any region of our site. ● Only one click on language can change your page to another language
  • 21. DRUPAL 8 MULTILINGUAL POSSIBILITIES FOR CUSTOMIZED CHECKOUT SYSTEM Thanks Questions