For WooCommerce sites, there's 2 pot files that need to be translated to your language - the WooCommerce pot file and the theme pot file.
The following is a step by step guide on how to translate your theme.
1.) Open wp-config.php in the root of your site. Look for define ('WPLANG', ' ');
2.) Edit that line to match your desired locality. For more information about your specific locality, review this
https://codex.wordpress.org/Installing_WordPress_in_Your_Language
http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html#Country-Codes
http://www.gnu.org/software/gettext/manual/html_chapter/gettext_16.html#Language-Codes
Some examples of valid language codes
Nederlands | define ( ‘WPLANG’ , ‘nl_NL’ ); |
Français | define ( ‘WPLANG’ , ‘fr_FR’ ); |
Deutsch | define ( ‘WPLANG’ , ‘de_DE’ ); |
French | define ( ‘WPLANG’ , ‘fr_FR’ ); |
Italian | define ( ‘WPLANG’ , ‘it_IT’ ); |
Save wp-config.php
3.) Grab your desired WooCommerce Language Pack.
As of WooCommerce 2.2, WooCommerce no longer include language files directly in WooCommerce - meaning you need to download your language pack.
You can find out how to do that here.
4.) Translate the theme .pot file.
Our recommended method for translating .pot files into your desired language is to use Poedit.
The theme pot file can be found in
/theme/languages/cglang.pot
The process for translating the theme language file is as follows:
- Open in Poedit and save as nl_NL.po/.mo (in this example – Dutch). Poedit will automatically save the .mo file for you when you save the .po file. The .mo file is one that WordPress will actually use to ready translated objects.
- Translate your strings using Poedit
- Save your new nl_NL.po AND nl_NL.mo file and upload them to the /theme/languages folder
- Really, really important! Your .po/.mo file must be named correctly in order for your translated strings to appear. So, for example, if your language constant is defined as nl_NL, then your .po/.mo files should be named as follows:
- nl_NL.po
- nl_NL.mo
- A full list of country codes can be found here - http://wpcentral.io/internationalization/
Once you've completed and uploaded your language files, you should now see your translations on your live site.
NOTE: If you still see English strings in your cart and have definitely translated all English strings this is most likely a browser session show an old cart session. To confirm, simply open your site in an incognito window/tab in Chrome to view your site uncached.
https://support.google.com/chrome/answer/95464?source=gsearch