SlideShare a Scribd company logo
1 of 21
DRUPAL 8 MULTILINGUAL
POSSIBILITIES FOR CUSTOMIZED
CHECKOUT SYSTEM
Drupal Camp Munich 2016
Ahmad Hassan Spotlight
Verlag
Sr. Web 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.
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

What's hot (20)

PHP Variables and scopes
PHP Variables and scopesPHP Variables and scopes
PHP Variables and scopes
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
PHP
PHPPHP
PHP
 
PHP
PHPPHP
PHP
 
PHP slides
PHP slidesPHP slides
PHP slides
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
PDF Localization
PDF  LocalizationPDF  Localization
PDF Localization
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
C:\Users\User\Desktop\Eclipse Infocenter
C:\Users\User\Desktop\Eclipse InfocenterC:\Users\User\Desktop\Eclipse Infocenter
C:\Users\User\Desktop\Eclipse Infocenter
 
Web programming
Web programmingWeb programming
Web programming
 
Xml tutorial
Xml tutorialXml tutorial
Xml tutorial
 
Xml
XmlXml
Xml
 
PhD Presentation
PhD PresentationPhD Presentation
PhD Presentation
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop Notes
 
Xml ppt
Xml pptXml ppt
Xml ppt
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 

Viewers also liked

Parker Kittiwake ANALEX pqL
Parker Kittiwake ANALEX pqL Parker Kittiwake ANALEX pqL
Parker Kittiwake ANALEX pqL Parker Kittiwake
 
Masters of Marketing: Social Media & Gaining Followers
Masters of Marketing: Social Media & Gaining FollowersMasters of Marketing: Social Media & Gaining Followers
Masters of Marketing: Social Media & Gaining FollowersDarmini Kara
 
Parker Kittiwake FTIR Infra-red Oil Analyser Brochure
Parker Kittiwake FTIR Infra-red Oil Analyser BrochureParker Kittiwake FTIR Infra-red Oil Analyser Brochure
Parker Kittiwake FTIR Infra-red Oil Analyser BrochureParker Kittiwake
 
Masters of Marketing -- How to Create Awesome Emails That Won't Get Deleted
Masters of Marketing -- How to Create Awesome Emails That Won't Get DeletedMasters of Marketing -- How to Create Awesome Emails That Won't Get Deleted
Masters of Marketing -- How to Create Awesome Emails That Won't Get DeletedDarmini Kara
 
Соціальні сервіси у відкритій освіті
Соціальні сервіси у відкритій освітіСоціальні сервіси у відкритій освіті
Соціальні сервіси у відкритій освітіAndriushchenko
 
Raport Metrohouse i Expandera Styczeń 2017
Raport Metrohouse i Expandera Styczeń 2017Raport Metrohouse i Expandera Styczeń 2017
Raport Metrohouse i Expandera Styczeń 2017Metrohouse
 
『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立
『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立
『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立jump-slide
 
Digital Soil Moisture Sensor
Digital Soil Moisture SensorDigital Soil Moisture Sensor
Digital Soil Moisture SensorRaghav Shetty
 
Penyakit kelapa sawit karat jelaga hawar kipas
Penyakit kelapa sawit karat jelaga hawar kipasPenyakit kelapa sawit karat jelaga hawar kipas
Penyakit kelapa sawit karat jelaga hawar kipassat rahayuwati
 
Mycobacteriology 2016
Mycobacteriology 2016Mycobacteriology 2016
Mycobacteriology 2016Margie Morgan
 
air pollution presentation
air pollution presentationair pollution presentation
air pollution presentationjesler
 

Viewers also liked (13)

Parker Kittiwake ANALEX pqL
Parker Kittiwake ANALEX pqL Parker Kittiwake ANALEX pqL
Parker Kittiwake ANALEX pqL
 
Masters of Marketing: Social Media & Gaining Followers
Masters of Marketing: Social Media & Gaining FollowersMasters of Marketing: Social Media & Gaining Followers
Masters of Marketing: Social Media & Gaining Followers
 
Parker Kittiwake FTIR Infra-red Oil Analyser Brochure
Parker Kittiwake FTIR Infra-red Oil Analyser BrochureParker Kittiwake FTIR Infra-red Oil Analyser Brochure
Parker Kittiwake FTIR Infra-red Oil Analyser Brochure
 
Masters of Marketing -- How to Create Awesome Emails That Won't Get Deleted
Masters of Marketing -- How to Create Awesome Emails That Won't Get DeletedMasters of Marketing -- How to Create Awesome Emails That Won't Get Deleted
Masters of Marketing -- How to Create Awesome Emails That Won't Get Deleted
 
Masters of Marketing: It Takes Two
Masters of Marketing: It Takes TwoMasters of Marketing: It Takes Two
Masters of Marketing: It Takes Two
 
Rkk11
Rkk11Rkk11
Rkk11
 
Соціальні сервіси у відкритій освіті
Соціальні сервіси у відкритій освітіСоціальні сервіси у відкритій освіті
Соціальні сервіси у відкритій освіті
 
Raport Metrohouse i Expandera Styczeń 2017
Raport Metrohouse i Expandera Styczeń 2017Raport Metrohouse i Expandera Styczeń 2017
Raport Metrohouse i Expandera Styczeń 2017
 
『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立
『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立
『医療トレーサビリティの提言』患者の健康・安全・安心に向けた医療トレーサビリティの確立
 
Digital Soil Moisture Sensor
Digital Soil Moisture SensorDigital Soil Moisture Sensor
Digital Soil Moisture Sensor
 
Penyakit kelapa sawit karat jelaga hawar kipas
Penyakit kelapa sawit karat jelaga hawar kipasPenyakit kelapa sawit karat jelaga hawar kipas
Penyakit kelapa sawit karat jelaga hawar kipas
 
Mycobacteriology 2016
Mycobacteriology 2016Mycobacteriology 2016
Mycobacteriology 2016
 
air pollution presentation
air pollution presentationair pollution presentation
air pollution presentation
 

Similar to Drupal 8 customized checkout system

Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013🚀 Bogdan Herea
 
Drupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization PresentationDrupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization PresentationMediacurrent
 
Multilingual Improvements for Drupal 8
Multilingual Improvements for Drupal 8Multilingual Improvements for Drupal 8
Multilingual Improvements for Drupal 8Acquia
 
Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Gábor Hojtsy
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer muniryaseen
 
Drupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toDrupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toGábor Hojtsy
 
Zend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessionsZend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessionsTricode (part of Dept)
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09Bastian Feder
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentMahmoud Samir Fayed
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash CourseWill Iverson
 
Drupal 8's Multilingual APIs: Building for the Entire World
Drupal 8's Multilingual APIs: Building for the Entire WorldDrupal 8's Multilingual APIs: Building for the Entire World
Drupal 8's Multilingual APIs: Building for the Entire WorldChristian López Espínola
 
Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Gábor Hojtsy
 
Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Gábor Hojtsy
 
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuunit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuGauravRawat830030
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semKavita Dagar
 
Android coding guide lines
Android coding guide linesAndroid coding guide lines
Android coding guide lineslokeshG38
 

Similar to Drupal 8 customized checkout system (20)

Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
Parler en plusieurs langues avec Drupal - Drupalcamp Paris 2013
 
Drupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization PresentationDrupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization Presentation
 
Multilingual Improvements for Drupal 8
Multilingual Improvements for Drupal 8Multilingual Improvements for Drupal 8
Multilingual Improvements for Drupal 8
 
Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Everything multilingual in Drupal 8
Everything multilingual in Drupal 8
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
Apa style-1 (1)
Apa style-1 (1)Apa style-1 (1)
Apa style-1 (1)
 
Drupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toDrupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward to
 
Zend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessionsZend framework 06 - zend config, pdf, i18n, l10n, sessions
Zend framework 06 - zend config, pdf, i18n, l10n, sessions
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09
 
Programming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) EnvironmentProgramming Without Coding Technology (PWCT) Environment
Programming Without Coding Technology (PWCT) Environment
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash Course
 
Drupal 8's Multilingual APIs: Building for the Entire World
Drupal 8's Multilingual APIs: Building for the Entire WorldDrupal 8's Multilingual APIs: Building for the Entire World
Drupal 8's Multilingual APIs: Building for the Entire World
 
ColdBox i18N
ColdBox i18N ColdBox i18N
ColdBox i18N
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Drupal7 multilingual
Drupal7 multilingualDrupal7 multilingual
Drupal7 multilingual
 
Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"
 
Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)
 
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshuunit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
unit 1 programming in c ztgdawte efhgfhj ewnfbshyufh fsfyshu
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
 
Android coding guide lines
Android coding guide linesAndroid coding guide lines
Android coding guide lines
 

Recently uploaded

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 

Recently uploaded (20)

Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 

Drupal 8 customized checkout system

  • 1. DRUPAL 8 MULTILINGUAL POSSIBILITIES FOR CUSTOMIZED CHECKOUT SYSTEM Drupal Camp Munich 2016 Ahmad Hassan Spotlight Verlag Sr. Web 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.
  • 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