{"id":47252,"date":"2015-04-20T01:37:55","date_gmt":"2015-04-20T05:37:55","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=47252"},"modified":"2016-02-25T04:25:00","modified_gmt":"2016-02-25T09:25:00","slug":"woocommerce-how-to-add-a-theme-localization","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/woocommerce-how-to-add-a-theme-localization.html","title":{"rendered":"WooCommerce. How to add theme localization"},"content":{"rendered":"<p>\r\n<p>This tutorial is going to show you how to add theme localization in WooCommerce.<\/p>\r\n<h3>Preparation<\/h3>\r\n<p>Before adding theme localization, WordPress needs to be told which language it should run under. Please perform the following steps: <\/p>\r\n<ol>\r\n<li>\r\n<p>To change language in WordPress, you need to reach <strong>wp-config.php<\/strong> file. This file is located in the root directory of the WordPress installation on your server.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Open <strong>wp-config.php<\/strong> file and modify the line <strong>&quot;define (&#39;WPLANG&#39;, &#39;&#39;);&quot;<\/strong>, or add it if it&#8217;s missing in your file. Insert your locale into the quotes. For example, if you want to translate your site into German language, you should edit this line the following way:<\/p>\r\n<pre>\r\ndefine(&#39;WPLANG&#39;, &#39;de_DE&#39;);  \r\n<\/pre>\r\n<p class=\"info-box\">NOTE: You can check the list of locales at <a href=\"http:\/\/wpcentral.io\/internationalization\/\" target=\"_blank\" rel=\"nofollow\">the following link<\/a>.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Then in your WordpPress admin panel navigate to <strong>Settings -&gt; General<\/strong> menu and at the bottom (where you can see <strong>Site Language<\/strong>) select the language that you&#8217;ve inserted locale for. Don&#8217;t forget to save the changes:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization1-300x168.jpg\" alt=\"woocommerce_add_theme_localization1\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-47253\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization1-300x168.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization1-150x84.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization1.jpg 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<\/ol>\r\n<p>Feel free to check the detailed tutorial: <a href=\"\/help\/wordpress-change-site-language-starting-wordpress-4.html\" target=\"_blank\">WordPress. How to change site language (starting from WordPress 4)<\/a>.<\/p>\r\n<h3>Adding Theme Localization <\/h3>\r\n<p>WooCommerce comes localization ready out of the box &#8211; all that&#8217;s needed is your translation.<\/p>\r\n<p><strong>Poedit<\/strong> is a free program that you can use to write translations for any software or web site that uses Gettext for localization &#8211; like WordPress. WordPress uses PO files for everything: WordPress core, themes and plugins.<\/p>\r\n<ol>\r\n<li>\r\n<p>Go to <a href=\"http:\/\/www.poedit.net\/download.php\" rel=\"nofollow\">http:\/\/www.poedit.net\/download.php<\/a> and download <strong>Poedit<\/strong> for your operation system (Wndows\/MAC). <\/p>\r\n<\/li>\r\n<li>\r\n<p>Install it on your computer: double click the downloaded file and follow the steps it suggests. At the end of the installation, make sure the <strong>Open Poedit After Installation<\/strong> option is checked and click <strong>Finish<\/strong>.<\/p>\r\n<\/li>\r\n<li>\r\n<p>WooCommerce comes with 2 POT files which can be imported into PoEdit to translate:<\/p>\r\n<ul class=\"list\">\r\n<li>\r\n<p><strong>woocommerce.pot<\/strong> &#8211; contains frontend strings;<\/p>\r\n<\/li>\r\n<li>\r\n<p><strong>woocommerce-admin.pot<\/strong> &#8211; contains admin strings.<\/p>\r\n<\/li>\r\n<\/ul>\r\n<p>These files are broken up to make the frontend more efficient.<\/p>\r\n<p>Connect to your FTP account or open File Manager of the Hosting Control Panel and go to <strong>wp-content\/plugins\/woocommerce\/i18n\/languages<\/strong> directory. You will find <strong>woocommerce.pot<\/strong> and <strong>woocommerce-admin.pot<\/strong> files there. Download them to your computer.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Each file is translated separately. To get started open installed PoEdit, navigate to <strong>File -&gt; New from POT\/PO file&#8230;<\/strong> menu and choose either woocommerce.pot or woocommerce-admin.pot file:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization2-300x170.jpg\" alt=\"woocommerce_add_theme_localization2\" width=\"300\" height=\"170\" class=\"aligncenter size-medium wp-image-47254\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization2-300x170.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization2-150x85.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization2.jpg 990w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>In the appeared <strong>Translation Language<\/strong> window select the language you are going to add translations for:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization3.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization3-300x170.jpg\" alt=\"woocommerce_add_theme_localization3\" width=\"300\" height=\"170\" class=\"aligncenter size-medium wp-image-47255\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization3-300x170.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization3-150x85.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization3.jpg 990w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Look for the text string you want to translate in the left column called <strong>Source Text<\/strong>. You can hit <strong>Ctrl + F<\/strong> hot-keys to look for a specific string of text.<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization4.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization4-300x170.jpg\" alt=\"woocommerce_add_theme_localization4\" width=\"300\" height=\"170\" class=\"aligncenter size-medium wp-image-47256\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization4-300x170.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization4-150x85.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization4.jpg 990w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>Click the text string to select. It will appear in the <strong>Source Text <\/strong>lower field. Change the text in the <strong>Translation<\/strong> bottom field:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization5.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization5-300x170.jpg\" alt=\"woocommerce_add_theme_localization5\" width=\"300\" height=\"170\" class=\"aligncenter size-medium wp-image-47257\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization5-300x170.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization5-150x85.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/04\/woocommerce_add_theme_localization5.jpg 990w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>When you are done, click <strong>Save<\/strong> button. You will be prompted to save your <strong>.po<\/strong> file &#8211; name it based on what you are translating to, for example, a DE translation should be saved as <strong>woocommerce-de_DE.po<\/strong> or <strong>woocommerce-admin-de_DE.po<\/strong> respectively. <\/p>\r\n<p>The <strong>.mo<\/strong> file will be generated automatically.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Upload both .po and .mo files to the <strong>wp-content\/languages\/woocommerce\/<\/strong> directory on your server using FTP software or File Manager. If you don&#8217;t have <strong>woocommerce<\/strong> folder under <strong>wp-content\/languages<\/strong> directory, please create it.<\/p>\r\n<p class=\"attention\">NOTE: If you keep your custom translations in <strong>woocommerce\/i18n\/languages<\/strong> (WooCommerce 2.2+ version) directory, they can be lost after WooCommerce upgrading. To make them upgrade safely, instead place them in <strong>wp-content\/languages\/woocommerce\/<\/strong>. All translations will be automatically added to <strong>wp-content\/languages\/woocommerce\/<\/strong> with WooCommerce 2.2+ version.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Now refresh your site and check if the text strings you&#8217;ve changed in Poedit are now updated on your site.<\/p>\r\n<\/li>\r\n<\/ol>\r\n<p>More information about WooCommerce Localization can be found on the <a href=\"http:\/\/docs.woothemes.com\/document\/woocommerce-localization\" target=\"_blank\" rel=\"nofollow\">WooCommerce official site<\/a>.<\/p>\r\n<p>This is the end of the tutorial. Now you know how to add theme localization in WooCommerce.<\/p>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=8apmNsY9sgE?width=1280&amp;height=720\" rel=\"prettyPhoto\">WooCommerce. How to add a theme localization<\/a><\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial is going to show you how to add theme localization in WooCommerce.<\/p>\n","protected":false},"author":53,"featured_media":47385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1556],"tags":[702,766,2418],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/47252"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=47252"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/47252\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/47385"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=47252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=47252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=47252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}