SlideShare a Scribd company logo
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.

More Related Content

Similar to 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 2
Atwix
 
Using of TDD practices for Magento
Using of TDD practices for MagentoUsing of TDD practices for Magento
Using of TDD practices for Magento
Ivan Chepurnyi
 
Curso Symfony - Clase 4
Curso Symfony - Clase 4Curso Symfony - Clase 4
Curso Symfony - Clase 4
Javier 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 2
Tadhg 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 Framework
Dirk Haun
 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
Chris Jean
 
Symfony 1, mi viejo amigo
Symfony 1, mi viejo amigoSymfony 1, mi viejo amigo
Symfony 1, mi viejo amigo
Jose Antonio Pio
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
Ravi Mehrotra
 
Mangento
MangentoMangento
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 2
Byrne Reese
 
Magento++
Magento++Magento++
Shopify Partner Social
Shopify Partner SocialShopify Partner Social
Shopify Partner Social
The Working Party
 
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
references
 
Hacking Movable Type
Hacking Movable TypeHacking Movable Type
Hacking Movable Type
Stefano Rodighiero
 
Develop magento 2 custom shipping module
Develop magento 2 custom shipping moduleDevelop magento 2 custom shipping module
Develop magento 2 custom shipping module
The Brihaspati Infotech Pvt. Ltd.
 
Test upload
Test uploadTest upload
Test upload
Darrell Lawson Jr.
 
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
Igor 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 2
AppJetty
 
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
Max Pronko
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
Anthony Montalbano
 

Similar to 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
 
Introduction to Mangento
Introduction to Mangento Introduction to Mangento
Introduction to Mangento
 
Mangento
MangentoMangento
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
 

More from 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 fly2
Mage 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 eCommerce
Mage 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 terminal
Mage Titans ES
 
Mikel Ruiz - Magento X-Files
Mikel Ruiz - Magento X-FilesMikel Ruiz - Magento X-Files
Mikel Ruiz - Magento X-Files
Mage 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 2
Mage Titans ES
 

More from 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
 

Recently uploaded

Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
uehowe
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
zoowe
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
cuobya
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Florence Consulting
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 

Recently uploaded (20)

Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
 
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
制作毕业证书(ANU毕业证)莫纳什大学毕业证成绩单官方原版办理
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 

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.