Search

Translating WooCommerce (Localization)

Introduction ↑ Back to Top

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, however for creating custom translations, we find 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 ↑ Back to Top

WordPress needs to be told which language it should run.

  1. Go to: Dashboard > Settings > General and change the Site language.

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 ↑ Back to Top

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 ↑ Back to Top

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

First go to https://translate.wordpress.org/projects/wp-plugins/woocommerce and look for your language in the list. Click the title to be taken to the section for that language.

2016-02-17 at 09.57

You’ll see a list of sub-projects which you can translate. In most cases you’ll want to translate or download stable, so click on the heading.

2016-02-17 at 09.59

Once viewing a subproject, scroll to the bottom for export options. Export a .mo file for use on your site.

2016-02-17 at 10.00

This file needs to be renamed to woocommerce-YOURLANG.mo uploaded to wp-content/languages/woocommerce/. Once uploaded, this translation file will be used.

Creating custom translations ↑ Back to Top

WooCommerce includes a language file (.pot file) which 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

Loco Translate is a free plugin that you can download here. You can also add directly from the WordPress administration, in Plugins > Add New.

Once you download and install Loco Translate, a new “Loco Translate” menu item is created with two sub-sections. By default, the “Manage Translations” section will list all your themes and plugins and display all available translations for each:

Loco Translate Listings

Loco Translate Listings

You can easily add new languages to a theme or a plugin using the Add New Language link:

Loco Translate: add new language

Loco Translate: add new language

Then 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 hit Start Translating:

Loco Translate: create new language

Loco Translate: Create new language

Start translating, and save when finished:

Loco Translate: Start translating!

Loco Translate: Start translating!

Creating custom translations with PoEdit

PoEdit is a more advanced alternative to Loco Translate. Only advanced users or translators wishing to contribute to WooCommerce core should attempt this method.

WooCommerce comes with 2 POT files which can be imported into PoEdit to translate. These files are broken up to make the frontend more efficient.

  • woocommerce.pot – Contains frontend strings
  • woocommerce-admin.pot – Contains admin strings

Each is translated separately. To get started open PoEdit and go to File > New catalog from POT file. Once you have done this, choose either woocommerce.pot or woocommerce-admin.pot and PoEdit will show the catalog properties window:

Properties

Properties

Enter your name and details, so other translators know who you are, and click ‘OK’. You will be prompted to 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 or woocommerce-admin-en_GB.po, respectively. Now the strings are listed.

Translate the strings

Translate the strings

After translating strings, you can save. The .mo file will be generated automatically.

You can update your .po file by opening it and then going to Catalog > Update from POT file. Choose the file and it will be updated accordingly.

Making your translation upgrade safe ↑ Back to Top

WooCommerce keeps translations in woocommerce/i18n/languages. These files are safe during plugin updates

However, be aware that 100% complete translations from translate.wordpress.org may overwrite these files if downloaded.

You can use a snippet to load a custom translation stored elsewhere.

Translating text without a localization file ↑ Back to Top

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:

  1. Original string — text you are translating. View the plugin source code to see the exact string.
  2. Text domain — woocommerce
  3. Text you want to display
Back to the top