How to Translate Business Directory Plugin to your Native Language
Business Directory uses the standard WordPress string externalization mechanism (PO files) to allow you to translate the plugin to any language you wish. We also support the use of WPML if you prefer. This article explains how to create a single-language translation file.
NOTE: These instructions have been updated for WP 4.0+, which has changed how translations are handled.
The Translation file can serve TWO purposes:
- To change the language Business Directory Plugin is displayed in from English to something else
- To change labels, strings and messages that you see in English to whatever you want (also in English)
Choose the proper steps based on which workflow you are following.
Please note–Business Directory Plugin does ship with SOME translations already completed for you! Please look under wp-content/plugins/business-directory-plugin/languages on your site server for the available files (as of Jan 2017, we have full Spanish, French, English, German, Arabic, Polish, and Swedish translations included).
To FULLY translate the plugin to another language, please follow THESE steps:
Business Directory Plugin can be translated into any language, per the WordPress text internationalization standards. For more general information about how WordPress supports externalized strings for plugins, please read this article first.
- Start with the POT file from Business Directory Plugin (in the wp-content/plugins/business-directory-plugin/languages directory of the plugin, named WPBDM.pot)
- Downloaded the POedit software (You can find it here)
- Translate all strings to your preferred language following the instructions in the POEdit documentation
- Save the file as WPBDM-<langcode_COUNTRY>.po, where <langcode_COUNTRY> represents your ISO language code/country combination, such as en_US (English, US), en_UK (English, UK), fr_FR (French, France), pt_BR (Portuguese, Brazil), etc. Country codes can be found on this GNU website.
- Upload this new language-coded file to the wp-content/languages/plugins/ on your website’s server (if it does not exist, please CREATE this directory first).
- The language of the website should be configured directly through General Settings section in the WordPress Dashboard: http://YOURSITE//wp-admin/options-general.php, where YOURSITE is replaced by the domain name of your WordPress site. Pick the correct language setting and be sure to Save Settings. For more information on doing this, see this WordPress Codex page on Installing WordPress in your Language.
- IMPORTANT: Be sure to flush any browser caching you have in addition to any WordPress/web hosting caching you have so that you can see your new strings.
- You should now see your site in the new language, with a few exceptions (see below!)
This will translate about 95% of the plugin. Further translation must happen in the following places, which are stored in the database:
- Your Business Directory Plugin page name must be translated to your native language (under Pages->All Pages)
- Strings that are inside the configuration (see under Directory Admin->Manage Options), such as the Terms and Conditions (General tab), the Submit Listing and Sticky Listing messages (Listings tab) must be translated
- Email templates (under Directory Admin->Manage Options, Email tab) must be translated
- Update all field labels, by going to Directory Admin->Manage Form Fields
After you do all of these, Business Directory Plugin is fully translated.
Where should I upload the translation file?
Translations files for other languages (WPBDM-<language_COUNTRY>.po and WPBDM-<language_COUNTRY>.mo) can be uploaded to one of the following locations:
1) wp-content/languages/plugins/ (RECOMMENDED)
2) <plugin-directory>/languages/ (DEFAULT)
<plugin-directory> is usually /wp-content/plugins/business-directory-plugin.
The best practice is to store custom translations in wp-content/languages/plugins/, because that way the translations won’t be deleted during an upgrade. Options 2 and 3 above will be overwritten on upgrade.
As of Business Directory Plugin 4.x, we now support loading translations from some other locations as well:
wp-content/languages/business-directory-plugin/WPBDM-en_US.mo, if present, will always be loaded (for users in “English/US” domains), allowing users to overwrite the translation of specific strings. They can create translation files that include only the strings that they want to change. WordPress will use their translations for those strings and use the ones provided by plugin in other cases.
Then, the plugin will check for each of the following files, in the given order, until one of them can be loaded.
Generated by us, included in the plugin.
Previous versions included the translations files in here, in the plugin’s root directory.
WordPress checks for files in this location automatically.
Last, but not least: If you are upgrading from an older version of BD and have an old translation file, you can UPGRADE the translation file instead of starting from scratch! See this article on how to do that: How to Upgrade your BD Translation File for New Plugin Versions.
BD also supports the use of WPML to do translations as well. We cover how to configure that in this article.
Furthermore, here’s a guide for translating WP plugins in general (including language codes, naming conventions, and encodings):