The Translation file can serve TWO purposes:
- To use AWPCP in a language other than English.
- To change labels, strings and messages that you see in English to something else also in English.
Choose the proper steps based on which workflow you are following.
Please note — AWPCP does ship with translations for SOME languages! Please look under wp-content/plugins/another-wordpress-classifieds-plugin/languages on your site server for the available files (we have French, English, German, Hungarian, Italian, Portuguese (Brazilian), Romanian, Russian and Spanish).
How to change some of the labels, strings and messages in AWPCP?
- Start with the main POT file from AWPCP (in the wp-content/plugins/another-wordpress-classifieds-plugin/languages directory of the plugin, named another-wordpress-classifieds-plugin.pot). Alternatively, if you are updating an existing translation to add missing strings, you will start with an existing PO file named another-wordpress-classifieds-plugin-{langcode_COUNTRY}.po, where {langcode_COUNTRY} represents your ISO language code/country combination, such as en_GB (English, GB), es_ES (Spanish, Spain), fr_FR (French, France), etc.
- Download the POedit software.
- Open the file, and search for the string(s) you wish to change. Change those labels in the file.
- Save the file as another-wordpress-classifieds-plugin-en_US.po to your local machine. Make sure POEdit also generated a another-wordpress-classifieds-plugin-en_US.mo file; you’ll have to upload both of them to your server (SEE BELOW FOR THE RIGHT LOCATIONS!). If you are editing an exsiting translation, replace en_US in the file name with en_GB, es_ES, fr_FR, etc, if necessary. Save a copy of those files on your local machine, just in case.
- Upload BOTH of these new language-coded files to the wp-content/languages/another-wordpress-classifieds-plugin/ directory on your website’s server (if it does not exist, please CREATE this directory first). Here is an example -- the folder in green, if it does not exist, must be added to your site:
- 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.
- If you are using AWPCP 4.0.0 or newer, the translation file should be loaded automatically.
- If you are using AWPCP 3.9.5 or older, go to Classifieds > Settings > General settings admin page, then find and check the box that says Turn On Translation File (POT)?
- 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.
- View the page in your browser that you changed–you should see your custom message there. If not, double check the steps above and make sure the caches are flushed.
How to FULLY translate AWPCP to another language?
AWPCP 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 AWPCP (in the wp-content/plugins/another-wordpress-classifieds-plugin/languagesdirectory of the plugin, named another-wordpress-classifieds-plugin.pot) or from an existing PO file in the same directory.
- Download the POedit software.
- Open the file and translate all strings to your preferred language.
- Save the file as another-wordpress-classifieds-plugin-{langcode_COUNTRY}.po, where {langcode_COUNTRY} represents your ISO language code/country combination, such as en_US (English, US), en_GB (English, GB), fr_FR (French, France), pt_BR (Portuguese, Brazil), etc. Country codes can be found on this GNU website.
- Make sure POEdit also generated a another-wordpress-classifieds-plugin-en_US.mo file; you’ll have to upload both of them to your server (SEE BELOW FOR THE RIGHT LOCATIONS!).
- Upload this new language-coded file to the wp-content/languages/another-wordpress-classifieds-plugin/ directory 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.
- If you are using AWPCP 4.0.0 or newer, the translation file should be loaded automatically.
- If you are using AWPCP 3.9.5 or older, go to Classifieds > Settings > General settings admin page, then find and check the box that says Turn On Translation File (POT)?
- 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!)
How to translate the name of pages, email templates and HTML templates in AWPCP?
The instructions above will translate about 95% of the plugin. Further translation must happen in the following places, which are stored in the database:
- Your AWPCP Page names must be translated to your native language
- Strings that are inside the configuration, such as the Welcome Message must be translated
- Email templates must be translated
- Strings used in the HTML templates for the ads and listings under Ad/Listing Settings must be translated
After you do all of these, AWPCP is fully translated.
Where should I upload the translation file for AWPCP?
Translations files for other languages (another-wordpress-classifieds-plugin-<language_COUNTRY>.po and another-wordpress-classifieds-plugin-<language_COUNTRY>.mo) can be uploaded to one of the following locations:
- wp-content/languages/another-wordpress-classifieds-plugin/ (RECOMMENDED)
- {plugin-directory}/languages/ (DEFAULT)
- {plugin-directory}
Note that {plugin-directory} is usually /wp-content/plugins/another-wordpress-classifieds-plugin.
The recommend 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 AWPCP 3.5.x, the plugin supports loading translations from several locations. The plugin will check for the following files, in the given order:
- wp-content/languages/another-wordpress-classifieds-plugin/another-wordpress-classifieds-plugin-<language_COUNTRY>.mo: A file generated following the instructions above.
- wp-content/languages/plugins/another-wordpress-classifieds-plugin-<language_COUNTRY>.mo: WordPress checks and loads this file automatically.
- {plugin-directory}/languages/another-wordpress-classifieds-plugin-<language_COUNTRY>.mo: A translation file generated by us and already included in the plugin.
- {plugin-directory}/another-wordpress-classifieds-plugin-<language_COUNTRY>.mo: Previous versions of the plugin included the translation file at this location.
What to do if some strings aren't translated after an update?
It is possible that the translation files don't include translations for strings that were recently added to the plugin. If you know how to translate those strings, you can use Poedit to modify the existing (and now incomplete) translation file to add the missing translations.
Follow steps 1-5 from the instructions to change some labels, strings and messages in AWPCP and don't forget to clear the website's and browser's cache when you are done, so that the new strings can be shown on the frontend.
NOTE: Some languages like English and Spanish have variants depending on the country, however Greek and many other languages do not have variants so they do not require the _COUNTRY
part in the name: another-wordpress-classifieds-plugin-{langcode_COUNTRY}.po
, only langcode
is required.
You can visit https://translate.wordpress.org/ and check to see if your language has variants and requires the country, or if langcode is enough:
How do I add new strings to my custom translation file for AWPCP?
If you are using a custom translation for your language is very likely that your PO file will become outdated when a new version of the plugin is released. Follow the instructions below to update your custom translation file to include an up to date list of strings to translate:
- Open existing translation file (another-wordpress-classifieds-plugin-de_DE.po, for example) using Poedit.
- Go to the Catalog menu and choose the Update from POT File sub menu.
- Use the Open File dialog to open the file another-wordpress-classifieds-plugin.pot, included in the languagesdirectory of AWPCP.
- Poedit will report how many strings were added and how many are obsolete. Click Ok to complete the update.
- Your custom PO file should be now updated. The status bar at the botton of Poedit will show the total number of strings in the translation file, as well as how many are pending translation and how many were automatically translated using fuzzy match.
- Strings that are not translated and those that were automatically translated need to be updated.WordPress does not recognize translations that are marked as fuzzy, so you need to updated or manually mark them as not-fuzzy.If you edit a fuzzy translation, it gets marked as non-fuzzy automatically, but that can also be done using the Needs Work button in Poedit’s UI. Clicking the button toggles the fuzzy status of the selected string.
- Make sure POEdit is configured to generate a .mo file when you save your PO file. The .mo file is a compiled version of the translations file and is the file WP will read to get translations for the plugin.
- Finally, save the catalog and make sure to copy both the .po and .mo files to the languages/ directory inside AWPCP plugin folder.
Can I help to translate AWPCP into other languages?
AWPCP ships with several translations besides English (Spanish and Dutch, for example). The Spanish is kept up to date for each release. We do try to include as many translations as we can in the plugin, but we rely on native speakers to contribute those. If you are interested in being a contributor or a translator, please do let us know.
You can see our progress on translations on WordPress.org here: https://awpcp.com/knowledge-base/translate-awpcp-native-language-modify-labels-awpcp/
The handbook for translators on WordPress is here: https://make.wordpress.org/polyglots/handbook/translating/glotpress-translate-wordpress-org/ and will get you started.