The following tutorial Create a WordPress plugin or theme translation using poedit shows you how to create or edit a language file for WordPress themes and plugins.
Last Updated: September 22, 2018
Latest News: I have updated the documentation.
In this tutorial the language po file edited is Spanish (Spain). The Spanish language files edited or created look like es_ES.po and es_ES.mo. However the po and mo file name in a plugin or theme are usually different. The following are examples of a po and mo file name for a theme and a plugin.
Example Plugin Name:
Example Theme Name:
Note: Nowadays most plugins and themes are 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 ) 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. If it doesn’t, it means you need to select poedit as the default program to open up po files.
Step 2 ) 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 following field Source text:. This string can now 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.
Step 3 ) In the following image the source text selected is Center. The translation word Centrar will be changed to a different word.
Step 4 ) In the following image you can see the new edited string Centro. Using Poedit allows you to make your translations more personal for your site.
Po File Changes Completed
Step 5 ) Once you have completed all the changes, click on Save button as illustrated in the following image.
Upload Files To Server
Step 6 ) After saving your changes, go back to the location where you opened the file to edit. You should see the following two files with updated entries.
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. This is becoming the default path to upload your mo and po files. Once you are in the following path you will choose plugins or themes directory.
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.
WordPress Setup Tutorial List: