Translating WooCommerce (Localization)

Introduction

WooCommerce comes localisation ready out of the box – all that’s needed is your translation (if the plugin does not come bundled with one for your language).

Before you begin

WooCommerce includes a language file (.po or .pot file) which contains all of the English text. You can find this language file inside the plugin folder in woocommerce/i18n/languages/. The default woocommerce frontend translation is inside the file woocommerce.pot. Copy this file and paste it to your desktop.

Translating with PoEdit

Donwload PoEdit and install. To get started open PoEdit and go to File > New catalog from POT file. Once you have done this, choose woocommerce.pot (the file you ‘ve pasted to your desktop) and PoEdit will show the catalog properties window:

Properties

Enter your name etc so other translators know who you are and click ‘ok’. After this you will be prompted to save your .po file – name it based on what you are translating to, for example, a GB translation would be saved as woocommerce-el_GR.po. See the complete list of language codes and country codes to find your exact locale. Now the strings will be listed.

After translating all strings you can save – the .mo file will also be generated automatically.

Setup wordpress

WordPress needs to be told which language it should run under. Open wp-config.php and modify the line below, or add it if it is missing. We’ve set it to Greek in the example below. See the complete list of language codes and country codes to find your exact locale.

define ('WPLANG', 'el_GR');

Finally, you need to include the .mo file you have already generated with PoEdit. To make your localization upgrade safe, create this folder wp-content/languages/woocommerce/ and paste inside the 2 files (the .po and .mo).

Updating your translation

To update your WooCommerce translations, open the .po file, make your changes and just press save. Refresh your WooCommerce page to see the changes.

WooCommerce themes

If you use a WooCommerce theme, it may be possible that the theme contains its own translations for some of the buttons. Check in the theme’s folder and check for a folder named “lang” or “languages” or something similar. Repeat the process above with the po file that you ‘ll find there.

Caching plugins

If you have any caching plugins enabled, make sure that you disable them until your translations are ready.

WooCommerce and WPML

If you use WPML plugin to show the site in multiple languages, than in order to see the translated WooCommerce assets for each language, you should duplicate all the WooCommerce extra pages (Cart page, Account page, etc.).

Also, make sure that you have WooCommerce Multilingual installed in order to see the translated links.

Also, when you delete a product, you will probably want it’s translation to be automatically deleted. To do so, go to WPML > Translation Management > Multilingual Content Setup and tick the ” When deleting a post, delete translations as well” checkbox.

  • Andris
    Posted at 16:43, 30 MarchReply

    Hi,
    I created .mo and .po files and uploaded them to woocommerce/i18n/languages/ where the .pot file is located. My wordpress language was previsously set to the same language as I translated the file to. None of the content is translated in my site. What could be the problem?

    • Website tutorials
      Posted at 07:07, 31 MarchReply

      Hi, try to upload the .mo and .po files to the folder wp-content/languages/woocommerce/.

  • Satriyo
    Posted at 10:54, 03 AprilReply

    It works!
    thanks a lot man, I’ve been searching how to do this for hours now and now it works! 😀

  • epitets
    Posted at 20:39, 11 AprilReply

    Thank you! After about five tries I finally did it. 🙂

  • Peter Pasztusics
    Posted at 14:21, 29 AprilReply

    Hi,

    I have done exactly what is written above, but I can not see the changes. Do you have any idea what can be wrong. I am using Avada theme, most part of woocommerce was translated, but ‘My Account’ login part in menu did not and ‘view cart’ also.

    • Website tutorials
      Posted at 07:11, 02 JuneReply

      Hi. It seems to me that you haven’t translated the theme’s po file. Have you done that?

  • Robu
    Posted at 08:59, 25 MayReply

    Hi!

    Downloaded the pot file from the woocommerce/i18n/languages/ to my desktop. Edited it with poedit and saved it. Moved the .po and .mo file to wp-content/languages/woocommerce but nothing happens.. What could be the problem?

    • Website tutorials
      Posted at 09:09, 25 MayReply

      What is the language you are trying to edit? And the language of the pot file? Did you edit the wp-config.php file?

  • Robu
    Posted at 09:14, 25 MayReply

    From english to finnish. The language of the pot file is english. Yes i did put the define string there..

  • Robu
    Posted at 09:40, 25 MayReply

    I replaced the woocommerce-fi.po and woocommerce-fi.mo files with the new ones and updated the config file. Even cleared all browsing history of my browser.. What I am trying to do is to translate 2 strings from my front site (add to cart and view product). Everything else is good but it have been like this for a few days now.

    • Website tutorials
      Posted at 09:49, 25 MayReply

      Try to upload the .mo and .po files to the folder wp-content/languages/plugins/

  • Robu
    Posted at 10:04, 25 MayReply

    Still nothing.. probably a bug or something on my website

    • Website tutorials
      Posted at 10:07, 25 MayReply

      Let me get this straight. All the other strings on your site are translated correctly in finnish, and only two of them (add to cart and view product) are in english?

  • Robu
    Posted at 10:12, 25 MayReply

    Yes and one word (cart) when you go to the shopping basket site.

    • Website tutorials
      Posted at 11:52, 25 MayReply

      Ok. Seems like a plugin conflict to me. As long as every other WooCommerce aspect in your site is translated to Finnish (eg. The product xxx was added to the cart, etc), there must be a plugin that overrides these 3 texts. Try disabling all the plugins (except for WooCommerce) and tell me if the problem persists.

  • Robu
    Posted at 12:11, 25 MayReply

    Disabled all plugins except WooCommerce. The problem is still there.. I going to try to delete all the translations and somehow start over and see if that helps anything.

    • Website tutorials
      Posted at 12:19, 25 MayReply

      1. Do you use a custom theme? Try switching the theme (use one of WordPress defaults).
      2. If you open the .po file (make sure that you open the correct .po file, the one that is used by your site) and search for the “add to cart” and “view product” strings, do you see the translations for them? Maybe it’s a false .po file.

    • Website tutorials
      Posted at 12:23, 25 MayReply

      Also make sure that you have the latest releases of WordPress and WooCommerce.

  • Robu
    Posted at 12:34, 25 MayReply

    1. Yes – Tshop. Tried switching but noone really work. Couldn’t see my products on the front page.
    2. Both add to cart and view products are translated.

    • Website tutorials
      Posted at 12:43, 25 MayReply

      Then I guess, it’s a theme problem. Does the theme has a folder inside named woocommerce? This is the folder where all the theme’s customizations occure for woo. If yes, try to remove it (keep somewhere to add it later after the test) and check again. Maybe in their PHP files, they override the default woo buttons.

  • Robu
    Posted at 08:42, 26 MayReply

    Both add to cart and view products are translated in the .po file. Feels like “we” have tried everything. What if I gave you the login information to my website and to my server, then you could take a look at it?

    • Website tutorials
      Posted at 08:13, 27 MayReply

      Found the problem! Actually 2 of them.

      1. The theme already had a pot file for some of the theme’s buttons. The “Add to cart” and “View product” are inside this pot file (as well as others like “search something”). Inside the theme’s folder “lang” you will find the po file named en_US. You copy that and paste it in the same location and name it “fi.po”. You then open it with PoEdit, make your translations and press save.

      2. You also have a caching plugin installed. This (for some caching reason) will not work if you have it enabled. First do all your translation, have your site ready and ONLY WHEN YOU HAVE THE FINAL SITE VERSION ENABLE THE CACHING PLUGIN.

      Problem solved!

Post A Comment

Anti-Spam Quiz: