SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Downloaden Sie, um offline zu lesen
Magento 2 : i18n – how can I rephrase that?
Mage Titans Spain | June 2017
My name is:
Tadhg
- g
About me?
Family always comes first…
Magento comes a distant second ☺ @TadhgBowe
▪ 300+ e-commerce websites since 1997
▪ Substantial e-commerce website experience (ca. 100 yrs)
▪ Magento specialists since 2010 (ca. 100 implementations)
▪ Magento 2 certified
▪ Shopify Plus certified
I work for a company called “Screen Pages”
7 YEARS OF
MAGENTO
Fiesta!! In my own village!!
Viva Madrid!
Today’s Agenda:
i18n in Magento 2
Focus on how language translations work
Let’s look at a few examples
Current limitations
Future nice to haves
Disclaimer:
I AM STILL LEARNING MAGENTO 2 ☺
i18n?
Let’s THINK BIG!
internationalisation and localisation are means of adapting computer
software to different languages, regional differences and technical
requirements of a target market (locale)
Don’t make the customer think!
Locale setting:
Stores > Configuration > General > Locale Options:
Contact Us - Write Us!
module-contact
vendor/magento/module-contact
module-contact: contents of en_US.csv
"Write Us","Write Us"
"Jot us a note and we’ll get back to you as quickly as possible.","Jot us a note and we’ll get back to you as
quickly as possible."
Name,Name
Email,Email
"Phone Number","Phone Number"
"What’s on your mind?","What’s on your mind?"
Submit,Submit
"Name: %name","Name: %name"
"Email: %email","Email: %email"
"Phone Number: %telephone","Phone Number: %telephone"
"Comment: %comment","Comment: %comment"
"Contacts Section","Contacts Section"
Contacts,Contacts
"Contact Us","Contact Us"
Export/Examine all translations:
bin/magento i18n:pack /[SITE PATH]/[SITE_NAME]/en_US.csv -d en_US
"Write Us","Write Us",module,Magento_Contact
Name,Name,module,Magento_Contact
Email,Email,module,Magento_Contact
"Phone Number","Phone Number",module,Magento_Contact
Submit,Submit,module,Magento_Contact
"Continue Shopping","Continue Shopping",module,Magento_Checkout
Email,Email,module,Magento_Catalog
Email,Email,module,Magento_Customer
Let’s take a closer look:
module-contact/view/frontend/templates/form.phtml
…<fieldset class="fieldset">

<legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Write Us') ?></span></legend><br />

<div class="field note no-label"><?php /* @escapeNotVerified */ echo __('Jot us a note and we’ll get back to
you as quickly as possible.') ?></div>

<div class="field name required">

<label class="label" for="name"><span><?php /* @escapeNotVerified */ echo __('Name') ?></span></label>

<div class="control">

<input name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('Name') ?>" value="<?php
echo $block->escapeHtml($this->helper('MagentoContactHelperData')->getPostValue('name') ?: $this-
>helper('MagentoContactHelperData')->getUserName()) ?>" class="input-text" type="text" data-
validate="{required:true}"/>

</div>

</div>

<div class="field email required">

<label class="label" for="email"><span><?php /* @escapeNotVerified */ echo __('Email') ?></span></label>

<div class="control">

<input name="email" id="email" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" value="<?php
echo $block->escapeHtml($this->helper('MagentoContactHelperData')->getPostValue('email') ?: $this-
>helper('MagentoContactHelperData')->getUserEmail()) ?>" class="input-text" type="email" data-
validate="{required:true, 'validate-email':true}"/>

</div>

</div>…
How do translations work:
public function loadData($area = null, $forceReload = false)

{

…

$this->_loadModuleTranslation();

$this->_loadThemeTranslation();

$this->_loadPackTranslation();

$this->_loadDbTranslation();

…
return $this;

}
[YOUR SITE]/vendor/magento/framework/Translate.php
Who wins?
1. $this->_loadDbTranslation();



Not there?
2. $this->_loadPackTranslation();



Not there?
3. $this->_loadThemeTranslation();



Not there?
4. $this->_loadModuleTranslation();



Not there? It will simply output the original phrase.

Golden rules for today:
WEBSITE OWNER ALWAYS THINKING BIG!
e.g. future multilingual website store views,
in-house seasonal store views
Not allowed to change a translation in template files
1. Inline translation:
From our Translate.php: $this->_loadDbTranslation();

Enabled via: Stores > Configuration > Advanced > Developer > Translate Inline > Enabled for
Storefront = Yes
(don’t forget Developer Client Restrictions > Allowed IPs).
Translation Phrases Stored in DB “translation” table.
1. Inline translation:
What about something like “Email”?
Our challenge is to change “Email” to “Your Email Address” and only on the Contact Us Page
Inline Translation: ‘Email’ to ‘Your Email Address’
Inline Translation: ‘Email’ to ‘Your Email Address’
Inline Translation: So where else might ‘Email’ change?
Inline Translations are GLOBAL across the frontend
2. Language Pack:
Language Pack: Folder structure
Language Pack: Example files
Some examples in es_ES.csv:
In our en_GB.csv:
(note: remember to clear your translation caches and any others that apply)
Language Pack: Results…
Language Pack Translations are GLOBAL across the frontend
Happy so far? ☺
3. Theme Translation: Folder structure
Theme Translation: en_GB.csv
In our en_GB.csv:
So! Did it work?
Theme Translation: Results…
Theme Translations are GLOBAL across the frontend
Theme Translation: Module level?
Will this work?!
Theme Translation: Module level - results…
Nothing changed.
So we’re a little stuck!
Nope!
Anything else?
1. $this->_loadDbTranslation(); (GLOBAL)

2. $this->_loadPackTranslation(); (GLOBAL)

3. $this->_loadThemeTranslation(); (GLOBAL)

4. $this->_loadModuleTranslation(); (MODULE)

What about theme level changes in a foreign language website
e.g. two Spanish store views?
How about this solution:
1. $this->_loadDbTranslation(); (GLOBAL)

2. $this->_loadThemeModuleTranslation(); (MODULE)

3. $this->_loadThemeTranslation(); (GLOBAL)

4. $this->_loadPackTranslation(); (GLOBAL)

5. $this->_loadModuleTranslation(); (MODULE)

But what about super active client…?
What if the client wants to change their own translations at a
very specific module level!?
Now we’re going places! ☺
1. $this->_loadClientMediaThemeModuleTranslation(); (MODULE)

2. $this->_loadClientMediaThemeTranslation(); (GLOBAL)

3. $this->_loadDbTranslation(); (GLOBAL) 

4. $this->_loadThemeModuleTranslation(); (MODULE)

5. $this->_loadThemeTranslation(); (GLOBAL)

6. $this->_loadPackTranslation(); (GLOBAL)

7. $this->_loadModuleTranslation(); (MODULE)

Our solution inside a module:
Getting thirsty… hurry up Tadhg!
Basket page translations:
Comes from a js-translation.json file
(pub/static/frontend/theme/locale)
Basket page translations: where they come from
<!-- ko ifnot: getCartParam('summary_count') -->

<strong class="subtitle empty" data-bind="visible:
closeSidebar()">

<!-- ko i18n: 'You have no items in your shopping cart.' --
><!-- /ko -->

</strong>
.../module-checkout/view/frontend/web/template/minicart/content.html
…/module-checkout/view/frontend/templates/cart/noItems.phtml
<div class="cart-empty">

<?php echo $block->getChildHtml('checkout_cart_empty_widget'); ?>

<p><?php echo __('You have no items in your shopping cart.') ?></p>
…

</div>
…
Be careful with this file!
Oops.
Careful: Theme translations don’t currently work with js-translation.json file.
In vendor/magento/module-translation/Model/Json/PreProcessor.php function process(…)
$area = $this->areaList->getArea($areaCode);
$area->load(MagentoFrameworkAppArea::PART_TRANSLATE);
needs to be:
$area = $this->areaList->getArea($areaCode);
$area->load(MagentoFrameworkAppArea::PART_DESIGN);
$area->load(MagentoFrameworkAppArea::PART_TRANSLATE);
Ref: https://github.com/magento/magento2/issues/8508#issuecomment-281329241
Careful when you change a phrase!
Another nice to have: Translation Phrase -> CMS Block:
In our en_GB.csv:
"Jot us a note and we’ll get back to you as quickly as possible.","{{{Contact_Us_Write_To_Us_Into}}}"
To summarise:
▪ Magento 2 has translations well covered.

▪ Make sure you create a i18n folder and translation .csv in your module.
▪ Try to avoid making phrase changes directly in template files.

▪ Be careful when making an existing phrase change. Does it exist elsewhere!?

▪ Read the devdocs ☺ devdocs.magento.com/guides/v2.0/ search for “Translations”

▪ Drink Horchata – It’s good for you too apparently! ☺
OMG! There’s an English (Ireland) locale…
Finally my favourite Irish translation phrase…
“to be sure”,”to be sure”
I
Cheers!
@TadhgBowe
Good Luck To You All! Gracias.

Weitere ähnliche Inhalte

Ähnlich wie Tadhg Bowe - i18n: how can I rephrase that?

Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Atwix
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for MagentoIvan Chepurnyi
 
Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4Javier Eguiluz
 
Screen Pages - Mage Titans - i18n Translations - Magento 2
Screen Pages  - Mage Titans - i18n Translations - Magento 2Screen Pages  - Mage Titans - i18n Translations - Magento 2
Screen Pages - Mage Titans - i18n Translations - Magento 2Tadhg Bowe
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkDirk Haun
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop APIChris Jean
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento Ravi Mehrotra
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Byrne Reese
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress sitereferences
 
Django - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazosDjango - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazosIgor Sobreira
 
How to create multi language store in magento 2
How to create multi language store in magento 2How to create multi language store in magento 2
How to create multi language store in magento 2AppJetty
 
Real use cases of performance optimization in magento 2
Real use cases of performance optimization in magento 2Real use cases of performance optimization in magento 2
Real use cases of performance optimization in magento 2Max Pronko
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckAnthony Montalbano
 

Ähnlich wie Tadhg Bowe - i18n: how can I rephrase that? (20)

Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for Magento
 
Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4
 
Screen Pages - Mage Titans - i18n Translations - Magento 2
Screen Pages  - Mage Titans - i18n Translations - Magento 2Screen Pages  - Mage Titans - i18n Translations - Magento 2
Screen Pages - Mage Titans - i18n Translations - Magento 2
 
Using Geeklog as a Web Application Framework
Using Geeklog as a Web Application FrameworkUsing Geeklog as a Web Application Framework
Using Geeklog as a Web Application Framework
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
 
Symfony 1, mi viejo amigo
Symfony 1, mi viejo amigoSymfony 1, mi viejo amigo
Symfony 1, mi viejo amigo
 
Mangento
MangentoMangento
Mangento
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
 
Magento++
Magento++Magento++
Magento++
 
Shopify Partner Social
Shopify Partner SocialShopify Partner Social
Shopify Partner Social
 
Gail villanueva add muscle to your wordpress site
Gail villanueva   add muscle to your wordpress siteGail villanueva   add muscle to your wordpress site
Gail villanueva add muscle to your wordpress site
 
Hacking Movable Type
Hacking Movable TypeHacking Movable Type
Hacking Movable Type
 
Develop magento 2 custom shipping module
Develop magento 2 custom shipping moduleDevelop magento 2 custom shipping module
Develop magento 2 custom shipping module
 
Test upload
Test uploadTest upload
Test upload
 
Django - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazosDjango - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazos
 
How to create multi language store in magento 2
How to create multi language store in magento 2How to create multi language store in magento 2
How to create multi language store in magento 2
 
Real use cases of performance optimization in magento 2
Real use cases of performance optimization in magento 2Real use cases of performance optimization in magento 2
Real use cases of performance optimization in magento 2
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 

Mehr von Mage Titans ES

David Bolufer - Make your magento2 fly2
David Bolufer - Make your magento2 fly2David Bolufer - Make your magento2 fly2
David Bolufer - Make your magento2 fly2Mage Titans ES
 
Oliver Montes - Chatbots para programadores y gestores eCommerce
Oliver Montes - Chatbots para programadores y gestores eCommerceOliver Montes - Chatbots para programadores y gestores eCommerce
Oliver Montes - Chatbots para programadores y gestores eCommerceMage Titans ES
 
Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...
Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...
Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...Mage Titans ES
 
Miguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminal
Miguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminalMiguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminal
Miguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminalMage Titans ES
 
Mikel Ruiz - Magento X-Files
Mikel Ruiz - Magento X-FilesMikel Ruiz - Magento X-Files
Mikel Ruiz - Magento X-FilesMage Titans ES
 
Oscar recio - De 0 a 100 con Magento 2
Oscar recio  -  De 0 a 100 con Magento 2Oscar recio  -  De 0 a 100 con Magento 2
Oscar recio - De 0 a 100 con Magento 2Mage Titans ES
 

Mehr von Mage Titans ES (6)

David Bolufer - Make your magento2 fly2
David Bolufer - Make your magento2 fly2David Bolufer - Make your magento2 fly2
David Bolufer - Make your magento2 fly2
 
Oliver Montes - Chatbots para programadores y gestores eCommerce
Oliver Montes - Chatbots para programadores y gestores eCommerceOliver Montes - Chatbots para programadores y gestores eCommerce
Oliver Montes - Chatbots para programadores y gestores eCommerce
 
Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...
Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...
Eli Barnett - El Comercio Unificado, borrando fronteras entre el mundo físico...
 
Miguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminal
Miguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminalMiguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminal
Miguel Balparda - Haciendo su vida más fácil con Magento 2 y la terminal
 
Mikel Ruiz - Magento X-Files
Mikel Ruiz - Magento X-FilesMikel Ruiz - Magento X-Files
Mikel Ruiz - Magento X-Files
 
Oscar recio - De 0 a 100 con Magento 2
Oscar recio  -  De 0 a 100 con Magento 2Oscar recio  -  De 0 a 100 con Magento 2
Oscar recio - De 0 a 100 con Magento 2
 

Kürzlich hochgeladen

Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girlsstephieert
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...sonatiwari757
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
SEO Growth Program-Digital optimization Specialist
SEO Growth Program-Digital optimization SpecialistSEO Growth Program-Digital optimization Specialist
SEO Growth Program-Digital optimization SpecialistKHM Anwar
 

Kürzlich hochgeladen (20)

Russian Call girls in Dubai +971563133746 Dubai Call girls
Russian  Call girls in Dubai +971563133746 Dubai  Call girlsRussian  Call girls in Dubai +971563133746 Dubai  Call girls
Russian Call girls in Dubai +971563133746 Dubai Call girls
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Call Girls In Noida 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Noida 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Noida 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Noida 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
Call Girls in Mayur Vihar ✔️ 9711199171 ✔️ Delhi ✔️ Enjoy Call Girls With Our...
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
SEO Growth Program-Digital optimization Specialist
SEO Growth Program-Digital optimization SpecialistSEO Growth Program-Digital optimization Specialist
SEO Growth Program-Digital optimization Specialist
 

Tadhg Bowe - i18n: how can I rephrase that?

  • 1. Magento 2 : i18n – how can I rephrase that? Mage Titans Spain | June 2017
  • 3. About me? Family always comes first… Magento comes a distant second ☺ @TadhgBowe
  • 4. ▪ 300+ e-commerce websites since 1997 ▪ Substantial e-commerce website experience (ca. 100 yrs) ▪ Magento specialists since 2010 (ca. 100 implementations) ▪ Magento 2 certified ▪ Shopify Plus certified I work for a company called “Screen Pages” 7 YEARS OF MAGENTO
  • 5. Fiesta!! In my own village!!
  • 7. Today’s Agenda: i18n in Magento 2 Focus on how language translations work Let’s look at a few examples Current limitations Future nice to haves
  • 8. Disclaimer: I AM STILL LEARNING MAGENTO 2 ☺
  • 9. i18n? Let’s THINK BIG! internationalisation and localisation are means of adapting computer software to different languages, regional differences and technical requirements of a target market (locale)
  • 10. Don’t make the customer think!
  • 11. Locale setting: Stores > Configuration > General > Locale Options:
  • 12. Contact Us - Write Us!
  • 14. module-contact: contents of en_US.csv "Write Us","Write Us" "Jot us a note and we’ll get back to you as quickly as possible.","Jot us a note and we’ll get back to you as quickly as possible." Name,Name Email,Email "Phone Number","Phone Number" "What’s on your mind?","What’s on your mind?" Submit,Submit "Name: %name","Name: %name" "Email: %email","Email: %email" "Phone Number: %telephone","Phone Number: %telephone" "Comment: %comment","Comment: %comment" "Contacts Section","Contacts Section" Contacts,Contacts "Contact Us","Contact Us"
  • 15. Export/Examine all translations: bin/magento i18n:pack /[SITE PATH]/[SITE_NAME]/en_US.csv -d en_US "Write Us","Write Us",module,Magento_Contact Name,Name,module,Magento_Contact Email,Email,module,Magento_Contact "Phone Number","Phone Number",module,Magento_Contact Submit,Submit,module,Magento_Contact "Continue Shopping","Continue Shopping",module,Magento_Checkout Email,Email,module,Magento_Catalog Email,Email,module,Magento_Customer
  • 16. Let’s take a closer look:
  • 17. module-contact/view/frontend/templates/form.phtml …<fieldset class="fieldset">
 <legend class="legend"><span><?php /* @escapeNotVerified */ echo __('Write Us') ?></span></legend><br />
 <div class="field note no-label"><?php /* @escapeNotVerified */ echo __('Jot us a note and we’ll get back to you as quickly as possible.') ?></div>
 <div class="field name required">
 <label class="label" for="name"><span><?php /* @escapeNotVerified */ echo __('Name') ?></span></label>
 <div class="control">
 <input name="name" id="name" title="<?php /* @escapeNotVerified */ echo __('Name') ?>" value="<?php echo $block->escapeHtml($this->helper('MagentoContactHelperData')->getPostValue('name') ?: $this- >helper('MagentoContactHelperData')->getUserName()) ?>" class="input-text" type="text" data- validate="{required:true}"/>
 </div>
 </div>
 <div class="field email required">
 <label class="label" for="email"><span><?php /* @escapeNotVerified */ echo __('Email') ?></span></label>
 <div class="control">
 <input name="email" id="email" title="<?php /* @escapeNotVerified */ echo __('Email') ?>" value="<?php echo $block->escapeHtml($this->helper('MagentoContactHelperData')->getPostValue('email') ?: $this- >helper('MagentoContactHelperData')->getUserEmail()) ?>" class="input-text" type="email" data- validate="{required:true, 'validate-email':true}"/>
 </div>
 </div>…
  • 18. How do translations work: public function loadData($area = null, $forceReload = false)
 {
 …
 $this->_loadModuleTranslation();
 $this->_loadThemeTranslation();
 $this->_loadPackTranslation();
 $this->_loadDbTranslation();
 … return $this;
 } [YOUR SITE]/vendor/magento/framework/Translate.php
  • 19. Who wins? 1. $this->_loadDbTranslation();
 
 Not there? 2. $this->_loadPackTranslation();
 
 Not there? 3. $this->_loadThemeTranslation();
 
 Not there? 4. $this->_loadModuleTranslation();
 
 Not there? It will simply output the original phrase.

  • 20. Golden rules for today: WEBSITE OWNER ALWAYS THINKING BIG! e.g. future multilingual website store views, in-house seasonal store views Not allowed to change a translation in template files
  • 21. 1. Inline translation: From our Translate.php: $this->_loadDbTranslation();
 Enabled via: Stores > Configuration > Advanced > Developer > Translate Inline > Enabled for Storefront = Yes (don’t forget Developer Client Restrictions > Allowed IPs). Translation Phrases Stored in DB “translation” table.
  • 23. What about something like “Email”? Our challenge is to change “Email” to “Your Email Address” and only on the Contact Us Page
  • 24. Inline Translation: ‘Email’ to ‘Your Email Address’
  • 25. Inline Translation: ‘Email’ to ‘Your Email Address’
  • 26. Inline Translation: So where else might ‘Email’ change? Inline Translations are GLOBAL across the frontend
  • 29. Language Pack: Example files Some examples in es_ES.csv: In our en_GB.csv: (note: remember to clear your translation caches and any others that apply)
  • 30. Language Pack: Results… Language Pack Translations are GLOBAL across the frontend
  • 32. 3. Theme Translation: Folder structure
  • 33. Theme Translation: en_GB.csv In our en_GB.csv: So! Did it work?
  • 34. Theme Translation: Results… Theme Translations are GLOBAL across the frontend
  • 35. Theme Translation: Module level? Will this work?!
  • 36. Theme Translation: Module level - results… Nothing changed. So we’re a little stuck! Nope!
  • 37. Anything else? 1. $this->_loadDbTranslation(); (GLOBAL)
 2. $this->_loadPackTranslation(); (GLOBAL)
 3. $this->_loadThemeTranslation(); (GLOBAL)
 4. $this->_loadModuleTranslation(); (MODULE)
 What about theme level changes in a foreign language website e.g. two Spanish store views?
  • 38. How about this solution: 1. $this->_loadDbTranslation(); (GLOBAL)
 2. $this->_loadThemeModuleTranslation(); (MODULE)
 3. $this->_loadThemeTranslation(); (GLOBAL)
 4. $this->_loadPackTranslation(); (GLOBAL)
 5. $this->_loadModuleTranslation(); (MODULE)

  • 39. But what about super active client…? What if the client wants to change their own translations at a very specific module level!?
  • 40. Now we’re going places! ☺ 1. $this->_loadClientMediaThemeModuleTranslation(); (MODULE)
 2. $this->_loadClientMediaThemeTranslation(); (GLOBAL)
 3. $this->_loadDbTranslation(); (GLOBAL) 
 4. $this->_loadThemeModuleTranslation(); (MODULE)
 5. $this->_loadThemeTranslation(); (GLOBAL)
 6. $this->_loadPackTranslation(); (GLOBAL)
 7. $this->_loadModuleTranslation(); (MODULE)

  • 41. Our solution inside a module:
  • 43. Basket page translations: Comes from a js-translation.json file (pub/static/frontend/theme/locale)
  • 44. Basket page translations: where they come from <!-- ko ifnot: getCartParam('summary_count') -->
 <strong class="subtitle empty" data-bind="visible: closeSidebar()">
 <!-- ko i18n: 'You have no items in your shopping cart.' -- ><!-- /ko -->
 </strong> .../module-checkout/view/frontend/web/template/minicart/content.html …/module-checkout/view/frontend/templates/cart/noItems.phtml <div class="cart-empty">
 <?php echo $block->getChildHtml('checkout_cart_empty_widget'); ?>
 <p><?php echo __('You have no items in your shopping cart.') ?></p> …
 </div> …
  • 45. Be careful with this file!
  • 46. Oops. Careful: Theme translations don’t currently work with js-translation.json file. In vendor/magento/module-translation/Model/Json/PreProcessor.php function process(…) $area = $this->areaList->getArea($areaCode); $area->load(MagentoFrameworkAppArea::PART_TRANSLATE); needs to be: $area = $this->areaList->getArea($areaCode); $area->load(MagentoFrameworkAppArea::PART_DESIGN); $area->load(MagentoFrameworkAppArea::PART_TRANSLATE); Ref: https://github.com/magento/magento2/issues/8508#issuecomment-281329241
  • 47. Careful when you change a phrase!
  • 48. Another nice to have: Translation Phrase -> CMS Block: In our en_GB.csv: "Jot us a note and we’ll get back to you as quickly as possible.","{{{Contact_Us_Write_To_Us_Into}}}"
  • 49. To summarise: ▪ Magento 2 has translations well covered.
 ▪ Make sure you create a i18n folder and translation .csv in your module. ▪ Try to avoid making phrase changes directly in template files.
 ▪ Be careful when making an existing phrase change. Does it exist elsewhere!?
 ▪ Read the devdocs ☺ devdocs.magento.com/guides/v2.0/ search for “Translations”
 ▪ Drink Horchata – It’s good for you too apparently! ☺
  • 50. OMG! There’s an English (Ireland) locale…
  • 51. Finally my favourite Irish translation phrase… “to be sure”,”to be sure” I
  • 52. Cheers! @TadhgBowe Good Luck To You All! Gracias.