SlideShare une entreprise Scribd logo
1  sur  24
INTERNATIONALIZING AND
LOCALIZING WORDPRESS THEME

              SANJIP SHAH
         Follow: @sanjipshah
   Contact: sanjiv.saha31@gmail.com
Overview
• Definition and Importance

• Overview of the Process
  – Load a text domain
  – WordPress functions
  – Poedit Software
  – Create a language file
  – Instruct WordPress to load the language file
WHAT?
• Internationalization(i18n)
    Process of making WordPress theme/plugin
    translation ready.


• Localization(l10n)
    Process of adapting internationalized WordPress
    theme/plugin for a specific language by translating
    text.
Why ?
• For Developers
   – Cover More Users



• For Users
   – Get other language




                           Figure: WordPress Sites in Different Languages
                              Source: http://en.wordpress.com/stats/
LOAD A TEXT DOMAIN



• First parameter:
  – Unique identifier
    (good practice to use theme’s name)

• Second parameter:
  – Folder of the language files.
PROCESSING TEXT MESSAGES
1. __() Function
   • Makes your text ready for translation and returning it for use
         in PHP.




2. _e() Function
   • Works similarly to echo in PHP by displaying text on the screen.
PROCESSING TEXT MESSAGES
3. esc_attr__() Function
    •   esc_attr__() is the internationalization equivalent of the esc_attr().
    •   esc_attr__() returns the translation for use in PHP.




4. esc_attr_e() Function
    •   Displays the translation on the screen.
PROCESSING TEXT MESSAGES
5. _x() Function
    •    Sometimes, you need to provide context for translations.




6. _ex() Function
    •    Works same as above except it displays the translation on the screen.
PROCESSING TEXT MESSAGES
7. _n() Function
  •   Differentiate between the singular and plural forms of text.




  •   We could also do as below for easiness.


  •   But does not work for all languages.

  •   For an example: In French. Using“journal(s)” wouldn ’t apply
      because the plural form of journal is journaux.
PROCESSING TEXT MESSAGES
• Other functions
  •   esc_html__()
  •   esc_html_e()
  •   esc_attr_x()
  •   esc_html_x()
  •   _nx()

  Resource: http://devotepress.com/community/part-i-
      internationalizing-and-localizing-wordpress-theme/
TRANSLATION FILES
•    There are 3 kind of files:
    1.   POT file
         – Contains a list of all translatable messages in our theme.

    2.   The .po file
         – Created when we translate a POT file to a particular language.
         – Contains Human Readable text.
         – Actually not necessary to run the translation.


    3.   The .mo file
         – The .mo is a binary file that is created automatically by
             translation software.
         – Not Human Readable.
CREATING POT FILE
Supported translation tools for WordPress, Some are listed below.
    1. Poedit: http://poedit.net

    2.   GlotPress: http://glotpress.org

    3.   Launchpad: https://translations.launchpad.net

    4.   Pootle: http://pootle.locamotion.org

    5.   Kbabel: http://i18n.kde.org

    6.   GNU Gettext: http://gnu.org/software/gettext
CREATING POT FILE
•   Open Poedit, and create a new catalog.
•   Fill in the project’s information in the “Project info” tab:




                    Fig 1. Poedit Project Info Tab
CREATING POT FILE
•   In “Paths” tab:




                      Fig 1. Poedit Paths Tab
CREATING POT FILE
•   In “Keywords” tab:




                   Fig 1. Poedit Keywords Tab

•   Click OK. Save the file and your pot file will be created.
CREATION OF .POT FILE




     Figure: POT file created.
THE POT FILE




Fig 1. The POT file
TRANSLATING THE POT FILE




 Figure: Translating a POT file anc creating .po and .mo file
CREATION OF .po and .mo FILE




     Figure: POT file, .po file and .mo file all created.
UPDATING THE CONFIGURATION FILE
  •   Open wp-config.php file.

  •   Replace



  •   With




Sources: http://svn.automattic.com/wordpress-i18n/
         http://codex.wordpress.org/Installing_WordPress_in_Your_Language
SO WHAT ABOUT PLUGINS?
• Loading Text Domain




• Rest is pretty much same.
SOME RESOURCES
•   http://wp.smashingmagazine.com/2011/12/29/internationalizing-
    localizing-wordpress-theme/Replace

•   http://devotepress.com/community/part-i-internationalizing-and-
    localizing-wordpress-theme/

•   http://codex.wordpress.org/I18n_for_WordPress_Developers

•   http://codex.wordpress.org/L10n:Localization_Teams

•   http://en.wikipedia.org/wiki/Internationalization_and_localization

•   http://devotepress.com/coding/data-validation-sanitization-
    wordpress-2/
Thank You!

Questions?

Contenu connexe

Tendances

Interoperable PHP
Interoperable PHPInteroperable PHP
Interoperable PHPweltling
 
Drupal Camp LA 2011: Typography modules for Drupal
Drupal Camp LA 2011: Typography modules for DrupalDrupal Camp LA 2011: Typography modules for Drupal
Drupal Camp LA 2011: Typography modules for DrupalAshok Modi
 
Plone A Content Management System Chitra Mohla
Plone A Content Management System Chitra MohlaPlone A Content Management System Chitra Mohla
Plone A Content Management System Chitra Mohlabrighteyes
 
LFC DjangoCon EU
LFC DjangoCon EULFC DjangoCon EU
LFC DjangoCon EUdiefenbach
 
[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategiesrahulbot
 
Drupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization PresentationDrupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization PresentationMediacurrent
 
Object oriented language
Object oriented languageObject oriented language
Object oriented languageFirman Syah
 
Drupal Backend Performance and Scalability
Drupal Backend Performance and ScalabilityDrupal Backend Performance and Scalability
Drupal Backend Performance and ScalabilityAshok Modi
 
Content Management with Plone
Content Management with PloneContent Management with Plone
Content Management with Plonebrighteyes
 
mod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLImod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLIJacques Woodcock
 
Ploneforwebdev
PloneforwebdevPloneforwebdev
Ploneforwebdevbrighteyes
 
Introduction To Web Development & The New Digital Workplace
Introduction To Web Development & The New Digital WorkplaceIntroduction To Web Development & The New Digital Workplace
Introduction To Web Development & The New Digital WorkplaceJen Wei Lee
 
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...Suzanne Dergacheva
 

Tendances (18)

Interoperable PHP
Interoperable PHPInteroperable PHP
Interoperable PHP
 
Drupal Camp LA 2011: Typography modules for Drupal
Drupal Camp LA 2011: Typography modules for DrupalDrupal Camp LA 2011: Typography modules for Drupal
Drupal Camp LA 2011: Typography modules for Drupal
 
Plone A Content Management System Chitra Mohla
Plone A Content Management System Chitra MohlaPlone A Content Management System Chitra Mohla
Plone A Content Management System Chitra Mohla
 
LFC DjangoCon EU
LFC DjangoCon EULFC DjangoCon EU
LFC DjangoCon EU
 
[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies
 
Linux programming - Getting self started
Linux programming - Getting self started Linux programming - Getting self started
Linux programming - Getting self started
 
Drupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization PresentationDrupalcamp Atlanta 2010 Internationalization Presentation
Drupalcamp Atlanta 2010 Internationalization Presentation
 
Object oriented language
Object oriented languageObject oriented language
Object oriented language
 
Command-Line 101
Command-Line 101Command-Line 101
Command-Line 101
 
Drupal Backend Performance and Scalability
Drupal Backend Performance and ScalabilityDrupal Backend Performance and Scalability
Drupal Backend Performance and Scalability
 
Content Management with Plone
Content Management with PloneContent Management with Plone
Content Management with Plone
 
mod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLImod_php vs FastCGI vs FPM vs CLI
mod_php vs FastCGI vs FPM vs CLI
 
ppt on html And c++
ppt on html And c++ppt on html And c++
ppt on html And c++
 
Ploneforwebdev
PloneforwebdevPloneforwebdev
Ploneforwebdev
 
Beginning development in go
Beginning development in goBeginning development in go
Beginning development in go
 
Introduction To Web Development & The New Digital Workplace
Introduction To Web Development & The New Digital WorkplaceIntroduction To Web Development & The New Digital Workplace
Introduction To Web Development & The New Digital Workplace
 
Php
PhpPhp
Php
 
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
Don't Get Lost in Translation: Multilingual Site Building with Drupal 7 at Dr...
 

En vedette

Building bridges peace by peace
Building bridges peace by peaceBuilding bridges peace by peace
Building bridges peace by peacegmasky
 
Reoptimization techniques for solving hard problems
Reoptimization techniques for solving hard problemsReoptimization techniques for solving hard problems
Reoptimization techniques for solving hard problemsJhoirene Clemente
 
Inter play at santa clara
Inter play at santa claraInter play at santa clara
Inter play at santa claragmasky
 
Sacred playful pilgrimage
Sacred playful pilgrimageSacred playful pilgrimage
Sacred playful pilgrimagegmasky
 
Advanced JS Deobfuscation
Advanced JS DeobfuscationAdvanced JS Deobfuscation
Advanced JS DeobfuscationMinded Security
 

En vedette (6)

Building bridges peace by peace
Building bridges peace by peaceBuilding bridges peace by peace
Building bridges peace by peace
 
Reoptimization techniques for solving hard problems
Reoptimization techniques for solving hard problemsReoptimization techniques for solving hard problems
Reoptimization techniques for solving hard problems
 
Inter play at santa clara
Inter play at santa claraInter play at santa clara
Inter play at santa clara
 
Sacred playful pilgrimage
Sacred playful pilgrimageSacred playful pilgrimage
Sacred playful pilgrimage
 
Randomized Computation
Randomized ComputationRandomized Computation
Randomized Computation
 
Advanced JS Deobfuscation
Advanced JS DeobfuscationAdvanced JS Deobfuscation
Advanced JS Deobfuscation
 

Similaire à Internationalizing and localizing wordpress theme

Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPressMarko Heijnen
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumBen Ramsey
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 
Preparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsPreparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsHPCC Systems
 
[EclipseCon France 2017] Eclipse Platform Generic Editor
[EclipseCon France 2017] Eclipse Platform Generic Editor[EclipseCon France 2017] Eclipse Platform Generic Editor
[EclipseCon France 2017] Eclipse Platform Generic EditorMickael Istria
 
Learn PHP Lacture1
Learn PHP Lacture1Learn PHP Lacture1
Learn PHP Lacture1ADARSH BHATT
 
From WordPress With Love
From WordPress With LoveFrom WordPress With Love
From WordPress With LoveUp2 Technology
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()Blue Elephant Consulting
 
node_js.pptx
node_js.pptxnode_js.pptx
node_js.pptxdipen55
 
Multi language for php with gettext
Multi language for php with gettextMulti language for php with gettext
Multi language for php with gettextBinh Quan Duc
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with PhingMichiel Rook
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptxadityakumawat625
 
Week 5
Week 5Week 5
Week 5A VD
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkitPaul Jensen
 
Week 5
Week 5Week 5
Week 5A VD
 

Similaire à Internationalizing and localizing wordpress theme (20)

Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPress
 
Desktop Apps with PHP and Titanium
Desktop Apps with PHP and TitaniumDesktop Apps with PHP and Titanium
Desktop Apps with PHP and Titanium
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Preparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsPreparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for Translations
 
WEB TECHNOLOGIES- PHP Programming
WEB TECHNOLOGIES-  PHP ProgrammingWEB TECHNOLOGIES-  PHP Programming
WEB TECHNOLOGIES- PHP Programming
 
Php intro
Php introPhp intro
Php intro
 
[EclipseCon France 2017] Eclipse Platform Generic Editor
[EclipseCon France 2017] Eclipse Platform Generic Editor[EclipseCon France 2017] Eclipse Platform Generic Editor
[EclipseCon France 2017] Eclipse Platform Generic Editor
 
Learn PHP Lacture1
Learn PHP Lacture1Learn PHP Lacture1
Learn PHP Lacture1
 
From WordPress With Love
From WordPress With LoveFrom WordPress With Love
From WordPress With Love
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
node_js.pptx
node_js.pptxnode_js.pptx
node_js.pptx
 
Multi language for php with gettext
Multi language for php with gettextMulti language for php with gettext
Multi language for php with gettext
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
 
Week 5
Week 5Week 5
Week 5
 
Desktop apps with node webkit
Desktop apps with node webkitDesktop apps with node webkit
Desktop apps with node webkit
 
Week 5
Week 5Week 5
Week 5
 

Dernier

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Dernier (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Internationalizing and localizing wordpress theme

  • 1.
  • 2. INTERNATIONALIZING AND LOCALIZING WORDPRESS THEME SANJIP SHAH Follow: @sanjipshah Contact: sanjiv.saha31@gmail.com
  • 3. Overview • Definition and Importance • Overview of the Process – Load a text domain – WordPress functions – Poedit Software – Create a language file – Instruct WordPress to load the language file
  • 4. WHAT? • Internationalization(i18n) Process of making WordPress theme/plugin translation ready. • Localization(l10n) Process of adapting internationalized WordPress theme/plugin for a specific language by translating text.
  • 5. Why ? • For Developers – Cover More Users • For Users – Get other language Figure: WordPress Sites in Different Languages Source: http://en.wordpress.com/stats/
  • 6. LOAD A TEXT DOMAIN • First parameter: – Unique identifier (good practice to use theme’s name) • Second parameter: – Folder of the language files.
  • 7. PROCESSING TEXT MESSAGES 1. __() Function • Makes your text ready for translation and returning it for use in PHP. 2. _e() Function • Works similarly to echo in PHP by displaying text on the screen.
  • 8. PROCESSING TEXT MESSAGES 3. esc_attr__() Function • esc_attr__() is the internationalization equivalent of the esc_attr(). • esc_attr__() returns the translation for use in PHP. 4. esc_attr_e() Function • Displays the translation on the screen.
  • 9. PROCESSING TEXT MESSAGES 5. _x() Function • Sometimes, you need to provide context for translations. 6. _ex() Function • Works same as above except it displays the translation on the screen.
  • 10. PROCESSING TEXT MESSAGES 7. _n() Function • Differentiate between the singular and plural forms of text. • We could also do as below for easiness. • But does not work for all languages. • For an example: In French. Using“journal(s)” wouldn ’t apply because the plural form of journal is journaux.
  • 11. PROCESSING TEXT MESSAGES • Other functions • esc_html__() • esc_html_e() • esc_attr_x() • esc_html_x() • _nx() Resource: http://devotepress.com/community/part-i- internationalizing-and-localizing-wordpress-theme/
  • 12. TRANSLATION FILES • There are 3 kind of files: 1. POT file – Contains a list of all translatable messages in our theme. 2. The .po file – Created when we translate a POT file to a particular language. – Contains Human Readable text. – Actually not necessary to run the translation. 3. The .mo file – The .mo is a binary file that is created automatically by translation software. – Not Human Readable.
  • 13. CREATING POT FILE Supported translation tools for WordPress, Some are listed below. 1. Poedit: http://poedit.net 2. GlotPress: http://glotpress.org 3. Launchpad: https://translations.launchpad.net 4. Pootle: http://pootle.locamotion.org 5. Kbabel: http://i18n.kde.org 6. GNU Gettext: http://gnu.org/software/gettext
  • 14. CREATING POT FILE • Open Poedit, and create a new catalog. • Fill in the project’s information in the “Project info” tab: Fig 1. Poedit Project Info Tab
  • 15. CREATING POT FILE • In “Paths” tab: Fig 1. Poedit Paths Tab
  • 16. CREATING POT FILE • In “Keywords” tab: Fig 1. Poedit Keywords Tab • Click OK. Save the file and your pot file will be created.
  • 17. CREATION OF .POT FILE Figure: POT file created.
  • 18. THE POT FILE Fig 1. The POT file
  • 19. TRANSLATING THE POT FILE Figure: Translating a POT file anc creating .po and .mo file
  • 20. CREATION OF .po and .mo FILE Figure: POT file, .po file and .mo file all created.
  • 21. UPDATING THE CONFIGURATION FILE • Open wp-config.php file. • Replace • With Sources: http://svn.automattic.com/wordpress-i18n/ http://codex.wordpress.org/Installing_WordPress_in_Your_Language
  • 22. SO WHAT ABOUT PLUGINS? • Loading Text Domain • Rest is pretty much same.
  • 23. SOME RESOURCES • http://wp.smashingmagazine.com/2011/12/29/internationalizing- localizing-wordpress-theme/Replace • http://devotepress.com/community/part-i-internationalizing-and- localizing-wordpress-theme/ • http://codex.wordpress.org/I18n_for_WordPress_Developers • http://codex.wordpress.org/L10n:Localization_Teams • http://en.wikipedia.org/wiki/Internationalization_and_localization • http://devotepress.com/coding/data-validation-sanitization- wordpress-2/