Appearance
Translate:
You may need to translate the strings of Go Cart into your languages. There are various ways to translate WordPress plugin strings. Here we will discuss the two most common ways to translate WordPress plugin strings.
Solution 1: Using Loco Translate plugin (Recommended)
Loco Translate provides in-browser editing of WordPress translation files directly from your WordPress dashboard itself. It is a free plugin and can be downloaded from here.
Below are the steps to translate Go Cart using Loco Translate plugin.
- Install and activate the Loco Translate plugin.
- Go to the Loco Translate plugin page from the WordPress dashboard.
- Click New language.
- Choose the language you want to translate the plugin into.
- Click start translating.
- Select the string that you would like to translate.
- Enter the translation in the text box.
- Click Save button.
- Done. You have successfully translated the string in your language.
What does the Loco Translate plugin do?
Under the hood, Loco translate plugin generates the .po
& .mo
files for the plugin. These files are used by WordPress to translate the plugin strings.
INFO
The .po
& .mo
files are generated in the languages
folder of the plugin.
Example: If you are translating into Spanish, the generated language files will be located at the Go Cart plugin language
folder with the following names go-cart-es_ES.po
& go-cart-es_ES.mo
respectively 🎉
Solution 2: Using Poedit
Poedit is a free and open source software for translating strings. It is available for Windows, Mac and Linux. You can download it from here.
Below are the steps to translate Go Cart using Poedit.
- Extract the zip file of Go Cart plugin.
- Install and open Poedit.
- Click Create New > select the go-cart.pot file from the language folder.
- Select the language from the dropdown & Click ok
- Select the string that you would like to translate & start translating the strings.
- Once you are done translating, click Save button from the top left bar.
- While saving, enter the name in the following format
go-cart-xx_XX.po
wherexx_XX
is the WordPress Locale code of the language you are translating into. - Now we also need to generate the
.mo
file too. To do that click File > Compile to MO. - Save the
.mo
file in the same folder as the.po
file. The naming convention for the.mo
file is exactly the same as.po
file. Here, name the file asgo-cart-xx_XX.mo
wherexx_XX
is the WordPress Locale code of the language you are translating into. - 🎉 Done You have successfully translated the plugin into your language.
INFO
For Spanish language, the language code is es_ES
.
Hence, the name of the .mo
file will be go-cart-es_ES.mo
. If you are not sure about the your WordPress Locale code then you can check it from here.
Once you are done with the translation, its time to copy the generated .mo
& .po
files to the Go Cart plugin language
folder.
- If you are using WordPress locally, then copy the
.mo
&.po
files to the Go Cart pluginlanguage
folder. - If you are using WordPress on a web hosting server, then upload the
.mo
&.po
files to the Go Cart pluginlanguage
folder using file manager or a FTP client.
Taking care of variables in the strings
Some strings in the plugin contain variables. For example, the string You have %s items in your cart
contains a variable like %s
or %d
. This variable is replaced by the number of items in the cart.
If you are translating the string You have %s items in your cart
into your language, you need to make sure that the variable %s
is not translated.
As shown in the above image, the variable %s
should NOT be translated.
INFO
If you are translating the string You have %s items in your cart
into Spanish, the translated string should be Tienes %s artículos en tu carrito
.
Conclusion
We hope that you have successfully translated the Go Cart plugin into your language. We discussed two ways to translate the plugin strings. You can use any of the methods to translate the plugin strings. However, we recommend using the Loco Translate plugin as it is easy to use and provides a user-friendly interface.