WordPress has language files that hold all of the messages and labels you see while using your site. You can change this text if you need to.
If you want to change any of this default WordPress text you'll need to work with something called a Portable Object Template file, or POT.
For the geeks amongst us, it uses the GNU gettext framework to manage all the messages. There are two other file types involved, PO and MO as well. Towards the bottom of the page we explain more about how these files work.
Fortunately for the non-geeks amongst us, there is an ingenious plugin that makes editing it's all very simple. The plugin is called CodeStyling Localization.
If you're lookng to translate your site, try our other tutorial on multilingual plugins. Here we're only going to show you how to edit small amounts of text.
Step 1. Install the Codestyling Localization plugin
Step 2. Access the plugin from the Tools Menu
Step 3. Create the languages folder
If you see this message, click the button to create the directory. If that fails, use a file manager and create the languages directory wp-content/languages (languages should be plural).
Step 4. Create the PO and MO files for WordPress in your language
Click Add New Language.
If the All Translation tab is active, you will see a all of the possible places you would need to edit the language files. The WordPress section will be most likely be blank. So you will need to add your language.
Notice that there are tabs across the top. These will take you directly to the ones for specific plugins and themes. You may have to add this language to all the PO files for every element of the site, so you will be repeating this procedure. Scroll down this page and you'll see the plugins and the themes. Add your language to each that you want to change.
Step 5. Choose the correct language
Step 6. Rescan the po file
Once the PO file is created you'll see a green box for the po and a white box for the mo. Clicking rescan will get all the information from the POT file and make it available in the interface.
If the mo box is red, it means you do not have proper permissions for writing to the file. Clicking the red box should fix it, but if it doesn't, you can chmod the permissions manually.
Be patient. This may take some time. You'll get a finished button to click when the process is completed. Don't navigate away from the page until it the process is done.
Step 7. Make a change
You won't be able to create the mo file until you've made at least one change here. Let's make a simple one. Scroll down the list, and find the string "Remember Me" and click the edit button on the right side of the row.
In the popup editor, you will only be able to make changes in the Translation box. Change the string to what you want and then click Save.
Now you'll see the original and the translation on the list. Scroll up to the top of the page.
Step 8. Generate the mo-file
Click generate mo-file. You can leave the Textdomain: as default.
Note the back to overview page button. You'll need it in a few seconds.
You will get date-time confirmation of when it was last written. Go back the top of the page and find the back to overview button.
Step 9. Rescan to enable the change
Click Rescan when you return to this page.
The mo box will be filled in. If it's green everything is good. If it's red, it means that the directory permissions are wrong. Clicking the box will attempt to fix it. If it doesn't fix it, then you can use a file manager and chmod it manually to something writable - 644, 666, 755 would probably all work.
The result of the change.
POT-PO-MO What are these special files and what do they do?
This is explained really well in the WordPress Codex, so I'm going to quote from the codex,
"There are three types of files used in the gettext translation framework. These files are used and/or generated by translation tools during the translation process, as follows:"
"POT (Portable Object Template) files
"PO (Portable Object) files
"MO (Machine Object) files
The nature of a POT file
The process using the plugin is extremely simple, but it can be a large tedious process. Often times you change something and the typeface is the wrong size or it doesn't fit the theme. If you understand the way the file works and the context you'll be able track down the problems.
If you ever need to do this manually or create a language file for a plugin you write, start by downloading this file from http://svn.automattic.com/wordpress-i18n/pot/trunk/wordpress.pot
Here's what's inside:
At the top of the file you'll see the version. Be sure the version matches the version of WordPress you are using. Below that you will see the actual language strings in three lines (or more).
Line 1 is the location of the file and the line number where you can find it used. Referred to as the context.
Above you can see line 43 of wp-activate.php. This is where you will find the html for this message. This is the context.
Sometimes the context is located in more than one file. For example, the word "Register" is used in 5 different php files.
And a word may be used in several different strings, so using a global search and replace utility won't work really well unless you understand how to search and replace regular expressions. Notice also that there is some markup included in the POT file itself such as the span tags in the second example. The second example also shows you that there are two translations needed one for singular and one for plural.
Not to over complicate this process, but the first time you try editing this you most likely will not get the result you want. Sitewide changes may require more than simply replacing the words or messages.
It pays to work slowly and check your work to make sure you do a thorough job.
All of our tutorials are published under the Creative Commons Attribution-NonCommercial license. This means: