WP Restaurant Listings (and all official add-ons) are fully internationalised allowing you to translate strings or use your own language if you don’t need it running in English. WP Restaurant Listings comes with several user contributed language files, but if yours is missing you can translate it yourself.
WP Restaurant Listings includes a language file (.po or .pot file) which contains all of the English text. You can find this language file inside the plugin folder in wp-restaurant-listings/languages/. The same languages directory is used for all add-ons.
Setting up WordPress in Your Language
WordPress needs to be told which language it should run under.
WordPress v4.0 and Above
Change the language in the admin settings screen. Settings > general > Site Language.
Translating the Plugin(s)
Translation Using Poedit
Poedit is an application you can use on your computer to translate a POT file into your language.
- Download and install Poedit
- Find the POT file in wp-restaurant-listings/languages/wp-restaurant-listings.pot
- Open the POT file in Poedit.
- Translate the strings into your language.
- Go to File → Save as… to save your translations in a PO file.
- When you are finished translating, go to File → Save as… again to generate the MO file.
- Or you can set your Poedit to always compile a MO file when saving changes by clicking File → Preferences and on the Editor tab check the Automatically compile .mo file on save box.
- Upload your PO and MO file to wp-content/languages/wp-restaurant-listings/
Updating your translation
After updates, you can update your po file by opening it and then going to Catalog > Update from POT file. Choose the file and it will be updated accordingly.
Translation Using Loco Translate
Loco Translate is a WordPress plugin that provides in-browser editing of PO files used for localizing WordPress plugins and themes.
You can then follow the instructions that take you through making a translation.
Keeping Translation Files Upgrade Safe
When WordPress does an automatic update to a plugin, any custom translation files inside the plugin directory will be lost, so please backup your po and mo files. With that in mind, you may want to use one of the following alternative methods of keeping translations upgrade safe.
Put Translations Inside the WP_LANG Directory
If the plugin supports it (WP Restaurant Listings does, and so do the latest add-ons) you can put your po and mo files in the WP_LANG directory which will keep them safe from updates. This is usually the wp-content/languages/ directory.
So for example, if you were translating the WP Restaurant Listings, you would put your mo file in wp-content/languages/wp-restaurant-listings/wp-restaurant-listings-LOCALE.mo, replacing LOCALE with your language code.
Naming of your MO files must be in the format:
Contribute Your Translation to Core
Core translations are hosted on WordPress.org:
Anyone can signup and start translating here and any updates will be included in WP Restaurant Listings updates. Contributing to these translations benefits all users since they will be pulled into the plugins when downloaded.
Tip: When You Only Need to Translate a Few Strings
If you only need to change or translate a few strings in a plugin, try the Say What plugin. This simple plugin lets you translate any string via the WordPress admin dashboard. For each string, you’ll need to provide the text domain of the plugin that contains it. You can find this in the root file of each plugin, e.g. the text domain for WP Restaurant Listings is https://github.com/wpdrift/WP-Restaurant-Listings/blob/master/wp-restaurant-listings.php#L10.