{"id":392,"date":"2021-07-01T17:34:39","date_gmt":"2021-07-01T14:34:39","guid":{"rendered":"http:\/\/wp.plumserver.com\/learn\/?p=392"},"modified":"2022-10-06T11:34:51","modified_gmt":"2022-10-06T08:34:51","slug":"how-to-translate-magento-extension-using-theme-files-translation","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/learn\/magento-1-theme-translation","title":{"rendered":"How to Translate Magento Extension Using Theme Translation Files"},"content":{"rendered":"\n<p>In this article, you will learn how to perform Magento theme files translation. Usually, the translations are being stored in the .csv files on your server. However, if for some reason there&#8217;s no CSV translation file translated for your language &#8211; you will need to create the .csv file from scratch. To create the CSV translation file &#8211; please follow the steps below.<\/p>\n\n\n\n<div class=\"wp-block-group pr-notice pr-notice-warning\"><div class=\"wp-block-group__inner-container\">\n<p class=\"pr-notice-title\">Important Information:<\/p>\n\n\n\n<p>Make sure to disable the Magento cache before proceeding with .csv file translation.<\/p>\n<\/div><\/div>\n\n\n\n<h2>Step 1. Create the required file for translation<\/h2>\n\n\n\n<p>First you need to set a locale in your Magento admin panel and create a translate.csv file in it. Please, check the directory:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">app\/design\/frontend\/&lt;theme>\/default\/locale\/languagecode_COUNTRYCODE<\/code><\/pre><\/div>\n\n\n\n<p>This is an example of the file for German translation:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\">app\/design\/frontend\/&lt;theme>\/default\/locale\/de_De<\/code><\/pre><\/div>\n\n\n\n<h2>Step 2. Translate the phrases according to the requirements<\/h2>\n\n\n\n<p>While translating, make sure all the strings in your .csv file start and end with double quotes, and are separated with comma [,], not semi-colon [;] or any other mark.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"Add to Cart\", \"Translated Text\"<\/code><\/pre><\/div>\n\n\n\n<p>You can change the default theme strings according to the requirements of your website.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"My Cart\",\"My Basket\"\n\"My Account\",\"Your Account\"<\/code><\/pre><\/div>\n\n\n\n<p>All the lines are case-sensitive, you should copy the phrase exactly as it is in the &#8220;en_US&#8221; version.<\/p>\n\n\n\n<p>In the source &#8220;en_US&#8221; version the text looks like this:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"%s Item(s)\",\"%s Item(s)\"<\/code><\/pre><\/div>\n\n\n\n<p>Whereas&nbsp;the translated text should look like this:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"%s Items\",\"%s Product(s)\"<\/code><\/pre><\/div>\n\n\n\n<p>If you need to set off a word or phrase by quotation marks, put two double quotation marks for such string.<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"String\",\"Translated word\"<\/code><\/pre><\/div>\n\n\n\n<p>You can also use HTML coding to alter your text. Check an example:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"Warning!\",\"&lt;strong style=\"color:red\">Attention!&lt;\/strong>\"<\/code><\/pre><\/div>\n\n\n\n<h2>Step 3. Save the CSV file in UTF-8 encoding<\/h2>\n\n\n\n<p>Make sure your text editor saves .csv files in UTF-8 encoding, as it supports different alphabets. If you edit the file using Excel, convert it into UTF-8 encoding once you finish editing.<\/p>\n\n\n\n<h3>How to translate the same element differently for different pages<\/h3>\n\n\n\n<p>While performing translation in this file &#8211; any word or phrase will be translated for the entire theme. If you need to translate the same element in different ways for different pages, you can use this example:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\">\"Mage_Catalog:Add to Cart\",\"Add to Basket\"\n\"Mage_Checkout:Add to Cart\",\"Add to my shopping cart\"<\/code><\/pre><\/div>\n\n\n\n<p>To read more information about Magento translations, please <a href=\"https:\/\/devdocs.magento.com\/guides\/v2.3\/frontend-dev-guide\/translations\/xlate.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">click here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article you will learn how to perform Magento 2 theme files translation. Usually, the translations are being stored in the .csv files on your server. However, if for some reason there&#8217;s no CSV translation file translated for your language &#8211; you will need to create the .csv file from scratch. Here&#8217;s a quick guide to creating the .csv translation file and applying the translated phrases. <\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[123],"tags":[141,137],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Translate Magento Extension Using Theme Translation Files - Magento Tutorials for Beginners &amp; Professionals<\/title>\n<meta name=\"description\" content=\"Learn how to perform Magento theme files translation. You need to create a translate.csv file and add the translational phrases correctly.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/plumrocket.com\/learn\/magento-1-theme-translation\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Translate Magento Extension Using Theme Translation Files - Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"og:description\" content=\"Learn how to perform Magento theme files translation. You need to create a translate.csv file and add the translational phrases correctly.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/learn\/magento-1-theme-translation\" \/>\n<meta property=\"og:site_name\" content=\"Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-01T14:34:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-06T08:34:51+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/392"}],"collection":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/comments?post=392"}],"version-history":[{"count":8,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":1247,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/392\/revisions\/1247"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/media?parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/categories?post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/tags?post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}