Jun 142017
 

Create a WordPress plugin or theme translation using poedit shows you how to create or edit a language file for themes and plugins.

Last Updated: May 8, 2019

Latest News: I have updated the documentation.

The language file used for editing in this tutorial is Spanish (Spain).  The locale for Spain is es_ES. When you create and save the Spanish files in Poedit it creates two files es_ES.po and es_ES.mo. However the po and mo file name in a plugin or theme will have the name of the plugin and theme added to the locale. 

Important: Make sure your file name is named correctly or else it will not work. For example: Don’t use the following names classipress_es_ES.po or classipress_es-ES.po because they will not work.

The following is an examples of properly named po and mo files for a theme and a plugin.

Example Theme Name:

  • classipress-es_ES.mo
  • classipress-es_ES.po

Example Plugin Name:

  • all-in-one-wp-security-and-firewall-es_ES.mo
  • all-in-one-wp-security-and-firewall-es_ES.po

Note: Remember there are many different Spanish locales, so make sure you are using the correct locale for your Spanish language.

Note: Nowadays plugins and themes can be translated online at translate.wordpress.org/.

What you need:

  • And ftp program like filezilla which is free or cPanel File Manager
  • Poedit to edit or create new po and mo files.
  • Loco Translate is becoming very popular. (Optional but highly recommended)

Create a WordPress plugin or theme translation using poedit

Step 1 ) Before you begin check to make sure you have set up your WordPress site with the correct language. Please check the following documentation Install WordPress In Your Own Language to learn more.

Step 2 ) Open Poedit in your computer or laptop. Click on Open button as illustrated in the image below. Search for the po file in your computer or laptop. In this example I am going to edit es_ES.po from Suffusion theme.

Note: You can also double click using your left mouse button the po file. Poedit should run and open the file for you. If it doesn’t, it means you need to select poedit as the default program to open up po files.

click-open-in-poedit-to-search-for-suffusion-language-po-file

Step 3 ) Once you have opened the es_ES.po file you will see many strings for translation. Each string you select for translation will show up in the field Source text:. The string selected can be translated into your language.

In this tutorial the language is Spanish (Spain). The translated strings will be edited under Translation: field. See image below.

Note: In your case you might be translating a different language.

suffusion-poedit-file-new

Step 4 ) In the following image the source text selected is Center. The current Spanish translation word used is Centrar. This will be edited to a different word.

suffusion-edit-string

Step 5 ) In the following image you can see the new edited string Centro. Using a program like Poedit allows you to make your translations more personal for your site.

suffusion-edited-string

Po File Changes Completed

Step 6 ) Once you have completed all the changes, click on Save button as illustrated in the following image. Your new po and mo files will be updated and ready for uploading to your server.

click-save-in-poedit-to-save-suffusion-language-po-file

Upload Files To Server

Step 7 ) After saving your changes, go back to the location where you opened the file to edit. You should see two files with updated entries.

In this example the files are:

Files created:

es_ES.mo
es_ES.po

The es_ES.mo file is generated automatically by Poedit when you save the changes made to your po file. Once you have completed all your changes and saved your file, you need to upload the new files to your server using FTP.

Nowadays the mo and po files can also be uploaded to the following directory path in WordPress. This is becoming the default path to upload your mo and po files, which also serves as a way to protect your customize translation. 

WordPress Languages Folders

  • yoursite.com/wp-content/languages/plugins/
  • yoursite.com/wp-content/languages/themes/

The other method still used today is the plugin and theme directory path. When you upload or install a plugin or theme with a language directory, it usually uploads the language files in the /languages/ folder. The following is an example of a plugin and theme directory path.

Plugin / Theme Language Folders

  • yoursite.com/wp-content/themes/theme-name/languages/
  • yoursite.com/wp-content/plugins/plugins-name/languages/

Note: Make sure you refresh your browser and delete your cache if you have a cache plugin installed in your site.

These are very simple and straight forward instructions. I wanted to keep them as simple as possible for you.

I keep updating this tutorial form time to time so come back soon to check the latest.

If you have any questions please let me know.

Enjoy.

WordPress Setup Tutorial List:

Manuel Ballesta Ruiz is a web developer, Blogger and WordPress Enthusiast.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.