Today, we’ll see how translations are working in the WordPress ecosystem.
First, you need to keep in mind that Polylang, Polylang Pro or Polylang for WooCommerce doesn’t translate anything. It “just” asks WordPress to load the correct language pack according to the language selected in front-end thanks to our language switcher.
How translations in WordPress works?
Before translating any strings, it’s good to know where to find them and how in general translation works.
As you know, in the WordPress ecosystem, we can find 3 big parts of components:
- WordPress Core
- Plugins
- Themes
About WordPress Core, it’s relatively simple because all the translations are made by volunteer at https://translate.wordpress.org/.
For themes and plugins, it’s a little bit more complicated because it exists free plugins and themes from WordPress.org but also Pro, Premium plugins. In this case, the translation must be provided by the plugin or the theme developer.
For example, at Polylang we have chosen to ask https://wp-translations.pro/ managing translation for Polylang (wp.org), Polylang Pro and Polylang for WooCommerce.
Once on the project page in translate.wordpress.org, you’ll be able to translate strings. For example, for WooCommerce, all strings for all locale available in WordPress ecosystem are translatable at https://translate.wordpress.org/projects/wp-plugins/woocommerce/.
Before being downloaded in your WordPress website, translations must be validated by confirmed contributors called General Translation Editor (GTE) or Project Translation Editor (PTE). Translations must reach 90% to generate a language pack.
A language pack is a bundle with a .po and a .mo file which will be sent to all WordPress installations using the plugin or the theme through the update mechanism.
How to translate ?
This article will speak about free plugins like WooCommerce and its “Add to cart” string:
About WooCommerce, and more largely all plugins, themes and WooCommerce Core, we would recommend you to work on translate.wp.org. This way, you will contribute to improve translation and your job will help other people using the same locale as you.
Remember, WordPress is developed and translated by volunteer, translating is a good way to give back to WordPress Community.
Finding & translating the string
Finding where the string is from is surely the most difficult. In the WooCommerce example, it may come from WooCommerce plugin but also your theme or a 3rd party plugin which comes and modify it by overriding template files for example.
All original strings in WordPress ecosystem must be in English. WordPress codebase mostly in PHP is localized as en_US.
Case of WooCommerce string
I usually use Loco Translate to find them.