Translating the Plugin
When it comes to translating the plugin, Poedit stands out as a versatile external software dedicated to the task. There are both free and premium versions available and although the PRO version has additional functionalities that speed up work, the free version is completely sufficient for smoothly translating language files.
Setting the WordPress Site Language
Navigate to your WordPress admin panel, go to ‘Settings’ -> ‘General’, and confirm that your desired language is set in the ‘Site Language’ dropdown menu. This action is crucial to ensure that the language file you create is properly utilized on your site.
File Formats
Translation is facilitated through .po and .mo files. These files hold the texts displayed within your plugin, with .pot file specifically serving as template containing source text but no translations.
Good to Know
.po stands for ‘portable object’. This human-readable file contains both the original texts and translations of the theme or plugin.
.mo stands for ‘machine object’. These files are machine-readable and are used by WordPress.
.pot stands for ‘portable object template’. These files contain source text but no translations, while .po files also contain the translations to a particular language.
Translating with Poedit
Locate the source .pot language file in the plugin’s languages directory:
{YOUR_WORDPRESS_FOLDER}/wp-content/plugins/chauffeur-booking-system/languages/chauffeur-booking-system.pot
Good to Know
To locate this file you can use any FTP client like FileZilla or any file manager available in your administration panel (e.g. cPanel).
Download the file chauffeur-booking-system.pot to your disk.
Download and install Poedit software from here.
Open Poedit, click on ‘Create new…’, then select your previously downloaded chauffeur-booking-system.pot file.
Choose the language you want to translate your plugin into.
Once loaded in Poedit, the content will be displayed as a table in the form of rows. The original phrases/words are on the left, while the suggested translations are on the right of the screen, making your work easier. In the lower part of the window, there are two fields with the source text and the translation (changed text).
Translate the rows of the table one by one or search (CTRL+F) for specific phrases/words to modify. Simply select a row and select the suggested translation on the right or enter your own in the ‘Translation’ box at the bottom of the window.
Important!
Some strings may contain symbols like ‘%s’, ‘%d’, or ‘&’. These correspond to numbers or specific characters. You may also encounter HTML code in the translation strings. Copy these characters and replace only the English text with your desired language.
Important!
At the bottom of the ‘Translation’ window there is a ‘Needs work’ toggle button. If this option is selected, the phrase will not be included in the translation.
Once all (or selected) phrases are translated, save the file as a new translation file. Go to ‘File’ -> ‘Save as…’ and name your file according to the scheme: plugin-name-locale_code.po so for the English version it will be the file name: chauffeur-booking-system-en_US.po.
Poedit will create two files: one with the .po extension and the other with the .mo extension, e.g.:
chauffeur-booking-system-en_US.po
chauffeur-booking-system-en_US.mo
Important!
Depending on the language of the translation, you must use a different so-called locale code. Therefore, for translation into French, the files should be named: chauffeur-booking-system-fr_FR.po and chauffeur-booking-system-fr_FR.mo. For translation into Portuguese, the files should be named: chauffeur-booking-system-pt_PT.po and chauffeur-booking-system-pt_PT.mo. See the full list of locale codes here.
Upload the files to the same location as the chauffeur-booking-system.pot file. Then disable any cache plugins in your WordPress installation or clear the cache in the settings of any caching plugins you’re using. Refresh the page (CTRL+F5) or clear your browser cache if necessary.
Summary
Document version: 1.0
Last updated: April 12, 2024
Plugin version: 6.8+