WooCommerce comes localization-ready out of the box. All that’s needed is a translation file for your language.
There are several methods to create a translation, most of which are outlined in the WordPress Codex. In most cases you can contribute to the project on translate.wordpress.org. For creating custom translations:
- The easiest method is to use a plugin called Loco Translate.
- More advanced users can use PoEdit.
Both methods are covered in this doc.
Set up WordPress in your language
WordPress needs to be told which language it should run.
- Go to: Dashboard > Settings > General and change the Site language.
- Go to: Dashboard > Updates and click on the button to update translations
Once this has been done, the shop displays in your locale if the language file exists. Otherwise, you need to create the language files (process explained below).
Contributing your Localization to Core
We maintain translations at our project on GlotPress. If you want to contribute translated strings to your language or wish to start a new translation, register at WordPress.org and start translating.
Translating WooCommerce into your language
Translation is managed by teams over at translate.wordpress.org. Stable versions and development versions of WooCommerce are translated here, and anyone can contribute.
When you install or update WooCommerce, WordPress will look for a 100% complete translation in your language and automatically download it. If there is no 100% complete translation you can download it manually, or we encourage you to contribute to get it to 100% so all users can benefit.
If you’re new to translating, checkout the translators handbook to get started.
Downloading translations from translate.wordpress.org manually
1/ Go to https://translate.wordpress.org/projects/wp-plugins/woocommerce and look for your language in the list.
2/ Click the title to be taken to the section for that language.
3/ Click the heading under Set/Sub Project to view and download a Stable version.
4/ Scroll to the bottom for export options. Export a .mo file for use on your site.
5/ Rename this file to woocommerce-YOURLANG.mo (e.g., Great Britain English should be en_GB).
6/ Upload to your site under wp-content/languages/woocommerce/. Once uploaded, this translation file may be used.
Creating custom translations
WooCommerce includes a language file (.pot file) that contains all of the English text. You can find this language file inside the plugin folder in woocommerce/i18n/languages/.
Creating custom translations with Loco Translate
1/ Download the free plugin called Loco Translate from here. Or add directly from the WordPress administration via Plugins > Add New.
2/ Install and Activate.
3/ Go to the new Loco Translate menu item created in your Dashboard with five sub-sections.
4/ Go to the Plugins section, and select WooCommerce:
5/ Add new languages using the Add New Language link:
6/ Choose the language to add in the list, or enter the language ISO code (ex: fr_FR, en_US etc…), and select the folder to add the translation files to, and click Start Translating:
Note that Loco Translate offers three different locations for your create the translating, the best choice is Custom if you are looking to have your own custom translating, you should avoid “Author” location since it’s inside the plugin and will be override on updates, there is also the “System” location that will be override by translations from translate.wordpress.org.
7/ Save when finished:
Note that when a new version of WooCommerce is released and updated on your site, you need refresh the .po file to look for new strings. Use the “Sync” button to find any new string to start translating.
Creating custom translations with PoEdit
PoEdit is a more advanced alternative to Loco Translate. Only advanced users or translators wishing to create a custom translation to WooCommerce should attempt this method.
WooCommerce comes with a POT file that can be imported into PoEdit to translate.
To get started:
1/ Open PoEdit and go to File > New catalog from POT file.
2/ Choose woocommerce.pot and PoEdit will show the catalog properties window:
3/ Enter your name and details, so other translators know who you are, and click ‘OK‘.
4/ Save your .po file. Name it based on what you are translating to, i.e., a GB translation is saved as woocommerce-en_GB.po . Now the strings are listed.
5/ Save after translating strings. The .mo file is generated automatically.
6/ Update your .po file by opening it and then go to Catalog > Update from POT file.
7/ Choose the file and it will be updated accordingly.
Making your translation upgrade safe
WooCommerce keeps translations in wp-content/languages/plugins, like all other plugins. But if you wish to include a custom translation, you can use the directory wp-content/languages/woocommerce, or you can use a snippet to load a custom translation stored elsewhere:
// Code to be placed in functions.php of your theme or a custom plugin file. | |
add_filter( ‘load_textdomain_mofile’, ‘load_custom_plugin_translation_file’, 10, 2 ); | |
/* | |
* Replace ‘textdomain’ with your plugin’s textdomain. e.g. ‘woocommerce’. | |
* File to be named, for example, yourtranslationfile-en_GB.mo | |
* File to be placed, for example, wp-content/lanaguages/textdomain/yourtranslationfile-en_GB.mo | |
*/ | |
function load_custom_plugin_translation_file( $mofile, $domain ) { | |
if ( ‘textdomain’ === $domain ) { | |
$mofile = WP_LANG_DIR . ‘/textdomain/yourtranslationfile-‘ . get_locale() . ‘.mo’; | |
} | |
return $mofile; | |
} |
Translating text without a localization file
Translate or replace default text
Using the Say What? plugin can assist if you only wish to translate or change a few words without editing a WordPress theme’s .PO file. Requires no custom code.
When activated, it asks for:
- Original string — text you are translating. View the plugin source code to see the exact string.
- Text domain — woocommerce
- Text you want to display
FAQ
Why some strings on the Checkout page are not being translated?
You may see that some of the strings are not being translated on the Checkout page. For example, in the screenshot below, Local pickup
shipping method, Cash on delivery
payment method and a message related to Privacy Policy are not being translated to Russian while the rest of the form is indeed translated:
This usually happens when you first install WooCommerce and select default site language (English) and later change the site language to another one. In WooCommerce, the strings that have not been translated in the screenshot, are stored in the database after the initial WooCommerce installation. Therefore, if the site language is changed to another one, there is no way for WooCommerce to detect a translatable string since these are database entries.
In order to fix it, navigate to WooCommerce settings corresponding to the string you need to change and update the translation there directly. For example, to fix the strings in our case above, you would need to do the following:
Local pickup
– navigate to WooCommerce / Settings / Shipping / Shipping Zones, select the shipping zone whereLocal pickup
is added, openLocal pickup
settings, and rename the method with the actual translation. Save the setting.Cash on delivery
– navigate to WooCommerce / Settings / Payments, selectCash on delivery
payment method, open its settings, and rename the method title, description, and instructions with the actual translation. Save the setting.- Message related to Privacy Policy – navigate to WooCommerce / Settings / Accounts & Privacy, scroll down to the
Privacy policy
section, and editRegistration privacy policy
andCheckout privacy policy
fields with the actual translation. Save settings.
Navigate back to the Checkout page – translations should be reflected there.