Your SlideShare is downloading. ×
  • Like
Internationalizing and localizing  wordpress theme
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Internationalizing and localizing wordpress theme


The slide is about Internationalizing and Localizing WordPress Theme and presented in WordCamp Nepal 2012. \ …

The slide is about Internationalizing and Localizing WordPress Theme and presented in WordCamp Nepal 2012. \
It is about how to make the WordPress theme translation ready by using the available Internationalization and localization WordPress functions. Then extracting all the translatable messages using appropriate software, writing translation and creating language files and using these file to have the WordPress theme in another language. So, overall it is the process to make the theme available in another language.

Published in Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 2. 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
  • 3. 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.
  • 4. Why ?• For Developers – Cover More Users• For Users – Get other language Figure: WordPress Sites in Different Languages Source:
  • 5. LOAD A TEXT DOMAIN• First parameter: – Unique identifier (good practice to use theme’s name)• Second parameter: – Folder of the language files.
  • 6. PROCESSING TEXT MESSAGES1. __() 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.
  • 7. PROCESSING TEXT MESSAGES3. 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.
  • 8. PROCESSING TEXT MESSAGES5. _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.
  • 9. PROCESSING TEXT MESSAGES7. _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.
  • 10. PROCESSING TEXT MESSAGES• Other functions • esc_html__() • esc_html_e() • esc_attr_x() • esc_html_x() • _nx() Resource: internationalizing-and-localizing-wordpress-theme/
  • 11. 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.
  • 12. CREATING POT FILESupported translation tools for WordPress, Some are listed below. 1. Poedit: 2. GlotPress: 3. Launchpad: 4. Pootle: 5. Kbabel: 6. GNU Gettext:
  • 13. 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
  • 14. CREATING POT FILE• In “Paths” tab: Fig 1. Poedit Paths Tab
  • 15. CREATING POT FILE• In “Keywords” tab: Fig 1. Poedit Keywords Tab• Click OK. Save the file and your pot file will be created.
  • 16. CREATION OF .POT FILE Figure: POT file created.
  • 17. THE POT FILEFig 1. The POT file
  • 18. TRANSLATING THE POT FILE Figure: Translating a POT file anc creating .po and .mo file
  • 19. CREATION OF .po and .mo FILE Figure: POT file, .po file and .mo file all created.
  • 20. UPDATING THE CONFIGURATION FILE • Open wp-config.php file. • Replace • WithSources:
  • 21. SO WHAT ABOUT PLUGINS?• Loading Text Domain• Rest is pretty much same.
  • 22. SOME RESOURCES• localizing-wordpress-theme/Replace• localizing-wordpress-theme/•••• wordpress-2/
  • 23. Thank You!Questions?