Creating a .po template can be tricky using Poedit, but here are the exact steps that work for me.
To create a new
template.mo files for your theme, ensure the theme is internationalized, and follow these steps:
- In your theme, create a directory called
- Open Poedit and visit Preferences; set to “Automatically compile .mo file on save”
- Go to File > New Catalog and fill in the fields as follows (modify values as needed):
- Project name and version: WordPress Example Theme 2.0
- Team: Example Team
- Team’s email address: firstname.lastname@example.org
- Language: English
- Charset: UTF-8
- Source code charset: UTF-8
- Plural Forms: nplurals=2; plural=(n != 1)
- Base path: .
- Paths: ..
- (and any others used in the theme)
After configuring the new poedit catalog, click “OK”, and then “Save as..”
.mo will be created automatically).
At this point, you’ll see “Source text” listed along with some other blank fields (Translation, Notes, et al). We’re just creating the template files, so nothing further needs done with translating all the strings or whatever.
To complete the process, click the “Update” button (click “OK” for “Update summary” popup). Then finally, “Save” again to make it all happen and then “Quit” and check your two new files. If all went well, your theme will now have a working
template.mo ready to go for localization.