Translating and editing language files (.po and .mo)
Typically each theme or plugin will have its own language file, located in the theme or plugin folder languages (ex: /wp-content/themes/example-theme/languages/… or /wp-content/plugins/example-plugin/languages/…). There will be at least two files, example.po and example.mo, these are the main ones. There may also be additional files, such as messages.po and messages.mo.
example.po – this is a ASCII file (readable text). It’s responsible for most of the text displayed on the website. This is the file that will be edited.
example.mo – this is a binary file (machine readable). This is the actual file used by WordPress and is compiled from the .po file.
Step 1: Download Poedit
While there are several such .po file editors out there, a highly recommended one is Poedit. It’s a free cross-platform gettext catalogs (.po files) editor.
- Download Poedit and install
Step 2: Download your theme.po file
To edit your example.po file, you must first download a copy of it to your computer.
Step 3: Run Poedit
Run Poedit and then click File and open example.po.
You should now see a list of strings, along with two separate horizontal window panes down at the bottom of the program, like this:
Step 4: Edit
To edit a string, within Pane 1, click on the string you wish to edit. You’ll then see the string appear in Pane 2. You should not edit the string in Pane 2 (this would also require editing your theme’s php files). Instead, click on Pane 3 and type the text you’d like to appear instead.
You may continue to edit strings by repeating the above procedure. Once you’re done editing, click File -> Save.
By saving, the program will automatically create a new file called example.mo. This file will appear in the same location on your computer as example.po.
Step 5: Upload to website
Lastly, you must now upload your updated theme.mo file to your theme’s language folder language, replacing the ‘old’ theme.mo file. You do NOT need to upload the .po file, but you may if you’d like. Only the .mo file is actually used by WordPress.
That’s it! Visit your website and hit “reload” to see the changes.