SliceWP is fully internationalized and translation ready. It also comes with a handful of translations out of the box.
However, if you’re not happy with the provided translations or if your language is missing from SliceWP, you can translate the plugin’s strings. This article will guide you, step-by-step, through this process.
1. Download and Install Poedit
Poedit is a translation file editor and is the default application WordPress recommends to edit translation files.
If you don’t already have Poedit installed on your computer, please install it. You can download it from their website, here: https://poedit.net/download/
2. Open the SliceWP POT file in Poedit
To translate SliceWP with Poedit, you will firstly need to open SliceWP’s translation template file with Poedit.
This template file contains all the strings found in the plugin. It’s the starting point for translating a WordPress plugin in another language. In SliceWP, this file is located in the /translations
folder of the plugin.
Here’s how you can download this file to your computer:
- Firstly, click here to download SliceWP to your computer. The
slicewp.zip
file should be downloaded. - Unzip the downloaded file.
- Navigate into the unzipped
slicewp
folder and then into thetranslations
folder. - Lastly, copy the
slicewp.po
file to your desktop.
Now that you have SliceWP’s translation template file, follow these steps to open it with Poedit:
- Firstly, open Poedit.
- On launch, the application will show you a few quick options. Select “Create new…”.
- This will prompt you to select a file from your computer. Select the
slicewp.po
file you’ve added to your desktop in the previous steps. - Lastly, Poedit will ask you to select the language you wish to translate this file into. For example, for Mexican Spanish, select “Spanish (Mexico)”.
3. Translating and saving the translation files
Now that you have the translation template file opened in Poedit, you can translate any of the strings found in SliceWP.
Translating the strings with Poedit
The main section in Poedit’s interface contains a list with all the strings found in the translation file. Click on any string.
In the bottom part of Poedit’s interface, you have two sections. Source text and Translation. The Source text section showcases the string from the plugin, while the Translation section allows you to add the translated string of the source one. This is how you translate a string.
Saving the translation files
When you have all the strings translated (or at least all the ones you want to translate), you need to generate the PO and MO translation files, which we’ll be uploading to your website in the next section.
To generate the PO file, click on File > Save and then the most critical step: rename the file.
The file name should contain the name of the plugin’s folder (in this case, slicewp
) plus the locale.
The locale consists of:
- Either the language code (in lowercase), for example
ca
for Catalan. - Or, the language code (in lowercase) and the country code (in uppercase), separated by an underscore. If we take the example from before, with the language Spanish (Mexico), the locale will be
es_MX
.
When we put the file name components together, we end up with either slicewp-ca.po
or slicewp-es_MX.po
.
Important: If the name does not exactly match, translations will not be applied. Please make sure that dashes and underscores are exactly as shown in the example.
Finally, when you save the PO file, a MO file will also be generated with the exact name (slicewp-es_MX.mo
for our example). If the MO file is not generated, you can click on File > Compile to MO to generate this file. Save it in the same directory as the PO file.
4. Adding your translation files to your website
Now that you’ve finished your translation, the last step is to upload the MO file to your website.
Here’s how:
- Firstly, log in via (S)FTP into your website and then navigate to the
/wp-content
folder of your WordPress installation. - Here, look for the
/languages
folder. If you don’t have this folder in/wp-content
, create it. - If the languages folder was already created, navigate into it and look for the
/plugins
folder. If it doesn’t exist, create it, then navigate into it. - Once you’re in the
/wp-content/languages/plugins
folder, upload the MO (PO is not needed) file there. - You’re done!
If you find this