{"id":507,"date":"2021-07-21T13:29:43","date_gmt":"2021-07-21T10:29:43","guid":{"rendered":"http:\/\/wp.plumserver.com\/learn\/?p=507"},"modified":"2022-10-05T19:04:06","modified_gmt":"2022-10-05T16:04:06","slug":"translating-magento-2-extension-using-csv-files","status":"publish","type":"post","link":"https:\/\/plumrocket.com\/learn\/magento-extension-translation","title":{"rendered":"How to Translate Magento 2 Extensions Using CSV Files"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this article, you will learn how to translate your Magento 2 extensions. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generally, Magento uses a translation dictionary so that you can localize your store. This dictionary is a .csv file with two columns: the original text in the source (en_US) locale and the translation of that text in a target locale. Therefore, you need to perform Magento 2 CSV files translation by adding and applying the translation phrases.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1. Create a CSV file &amp; copy phrases for translation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create the <code class=\"\" data-line=\"\">your_lanuage_code.csv<\/code> file in the <code class=\"\" data-line=\"\">app\/code\/Plumrocket\/&lt;Module_Name&gt;\/i18n<\/code> directory:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">Example for German<\/div><pre><code class=\"language-markup\" data-line=\"\">app\/code\/Plumrocket\/&lt;Module_Name&gt;\/i18n\/de_DE.csv <\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the phrases you need to translate from the following file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-markup\" data-line=\"\">app\/code\/Plumrocket\/&lt;Module_Name&gt;\/i18n\/en_US.csv <\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">If the file is missing, you need to add a set of phrases for translation manually into the <code class=\"\" data-line=\"\">app\/code\/Plumrocket\/&lt;Module_Name&gt;\/i18n\/de_DE.csv<\/code> file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2. Translate phrases in each string<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open this <code class=\"\" data-line=\"\">.csv<\/code> file using any text editor (e.g. Notepad++) and translate the phrase in each string. All the phrases in your .csv file should be written in double quotes and should be separated by commas [,]<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">Translation example into German<\/div><pre><code class=\"language-json\" data-line=\"\">&quot;Add to Cart&quot;, &quot;In den Warenkorb&quot;<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3. Remove the js-translation.json file<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now you have to apply the translation you have entered in the <code class=\"\" data-line=\"\">.csv<\/code> file.&nbsp;Please, proceed with the following steps:<\/p>\n\n\n\n<p class=\"pr-notice pr-notice-info wp-block-paragraph\">In Developer mode, you can disable Magento Cache to display changes instantly (does not apply to JS translation). <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the terminal, switch to your Magento 2 root directory using the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\" data-line=\"\">cd \/FULL_PATH_TO_YOUR_MAGENTO2<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the following file:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\" data-line=\"\">pub\/static\/frontend\/&lt;vendor&gt;\/&lt;theme_name&gt;\/&lt;locale_code&gt;\/js-translation.json<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">Example file name for Luma theme in German <\/div><pre><code class=\"\" data-line=\"\">pub\/static\/frontend\/Magento\/luma\/de_DE\/js-translation.json<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4. Deploy the CSV file with translation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Next, run the following command to deploy the translated file (please skip this step if Magento is in developer mode):<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"\" data-line=\"\">php bin\/magento setup:static-content:deploy --theme &lt;vendor&gt;\/&lt;theme_name&gt; &lt;locale_code&gt;<\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div class=\"prism-title\">Command example for Luma theme in German <\/div><pre><code class=\"\" data-line=\"\">php bin\/magento setup:static-content:deploy --theme Magento\/luma de_DE<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5. Flush Magento cache<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Flush Magento Cache using the following command:<\/p>\n\n\n\n<div class=\"wp-block-prismatic-blocks\"><div><\/div><pre><code class=\"language-bash\" data-line=\"\">php bin\/magento cache:flush<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Please make sure to refresh the page after you have applied your translation. If necessary, please check <a href=\"https:\/\/devdocs.magento.com\/guides\/v2.3\/frontend-dev-guide\/translations\/xlate.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Magento DevDocs<\/a> for more information about Magento 2 translation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><!-- wp:paragraph --><\/p>\n<p>Generally, Magento uses a translation dictionary so that you can localize your store. This dictionary is a .csv file with two columns: the original text in the source (en_US) locale and the translation of that text in a target locale. Therefore, you need to perform Magento 2 CSV files translation by adding and applying the translation phrases.<\/p>\n<p><!-- \/wp:paragraph --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[123],"tags":[138,137],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-magento-frontend-dev-guide","tag-magento-configuration","tag-magento-translation","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Translate Magento 2 Extensions Using CSV Files - Magento Tutorials for Beginners &amp; Professionals<\/title>\n<meta name=\"description\" content=\"Learn how to add translational phrases to a CSV file and apply them correctly in order to translate Magento 2 extensions.\" \/>\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-extension-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 2 Extensions Using CSV Files - Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"og:description\" content=\"Learn how to add translational phrases to a CSV file and apply them correctly in order to translate Magento 2 extensions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/plumrocket.com\/learn\/magento-extension-translation\" \/>\n<meta property=\"og:site_name\" content=\"Magento Tutorials for Beginners &amp; Professionals\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-21T10:29:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-05T16:04:06+00:00\" \/>\n<meta name=\"author\" content=\"Anastasiia Yaremchuk\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anastasiia Yaremchuk\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Translate Magento 2 Extensions Using CSV Files - Magento Tutorials for Beginners &amp; Professionals","description":"Learn how to add translational phrases to a CSV file and apply them correctly in order to translate Magento 2 extensions.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/plumrocket.com\/learn\/magento-extension-translation","og_locale":"en_US","og_type":"article","og_title":"How to Translate Magento 2 Extensions Using CSV Files - Magento Tutorials for Beginners &amp; Professionals","og_description":"Learn how to add translational phrases to a CSV file and apply them correctly in order to translate Magento 2 extensions.","og_url":"https:\/\/plumrocket.com\/learn\/magento-extension-translation","og_site_name":"Magento Tutorials for Beginners &amp; Professionals","article_published_time":"2021-07-21T10:29:43+00:00","article_modified_time":"2022-10-05T16:04:06+00:00","author":"Anastasiia Yaremchuk","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Anastasiia Yaremchuk","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/plumrocket.com\/learn\/magento-extension-translation#article","isPartOf":{"@id":"https:\/\/plumrocket.com\/learn\/magento-extension-translation"},"author":{"name":"Anastasiia Yaremchuk","@id":"https:\/\/plumrocket.com\/learn\/#\/schema\/person\/e58760eb45dab7b988fbd2ae2fc84e9c"},"headline":"How to Translate Magento 2 Extensions Using CSV Files","datePublished":"2021-07-21T10:29:43+00:00","dateModified":"2022-10-05T16:04:06+00:00","mainEntityOfPage":{"@id":"https:\/\/plumrocket.com\/learn\/magento-extension-translation"},"wordCount":311,"commentCount":0,"keywords":["magento configuration","magento translation"],"articleSection":["Magento Frontend Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/plumrocket.com\/learn\/magento-extension-translation#respond"]}]},{"@type":"WebPage","@id":"https:\/\/plumrocket.com\/learn\/magento-extension-translation","url":"https:\/\/plumrocket.com\/learn\/magento-extension-translation","name":"How to Translate Magento 2 Extensions Using CSV Files - Magento Tutorials for Beginners &amp; Professionals","isPartOf":{"@id":"https:\/\/plumrocket.com\/learn\/#website"},"datePublished":"2021-07-21T10:29:43+00:00","dateModified":"2022-10-05T16:04:06+00:00","author":{"@id":"https:\/\/plumrocket.com\/learn\/#\/schema\/person\/e58760eb45dab7b988fbd2ae2fc84e9c"},"description":"Learn how to add translational phrases to a CSV file and apply them correctly in order to translate Magento 2 extensions.","breadcrumb":{"@id":"https:\/\/plumrocket.com\/learn\/magento-extension-translation#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/plumrocket.com\/learn\/magento-extension-translation"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/plumrocket.com\/learn\/magento-extension-translation#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Learn","item":"https:\/\/plumrocket.com\/learn"},{"@type":"ListItem","position":2,"name":"How to Translate Magento 2 Extensions Using CSV Files"}]},{"@type":"WebSite","@id":"https:\/\/plumrocket.com\/learn\/#website","url":"https:\/\/plumrocket.com\/learn\/","name":"Magento Tutorials for Beginners &amp; Professionals","description":"Plumrocket Inc","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/plumrocket.com\/learn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/plumrocket.com\/learn\/#\/schema\/person\/e58760eb45dab7b988fbd2ae2fc84e9c","name":"Anastasiia Yaremchuk","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2024\/01\/avatar_user_3_1704905220-96x96.png","url":"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2024\/01\/avatar_user_3_1704905220-96x96.png","contentUrl":"https:\/\/plumrocket.com\/learn\/wp-content\/uploads\/2024\/01\/avatar_user_3_1704905220-96x96.png","caption":"Anastasiia Yaremchuk"},"description":"Deeply passionate about making a good copy. Now exploring new horizons of SEO and content marketing. Apart from the digital world, she is obsessed with travelling, films and caffeine.","url":"https:\/\/plumrocket.com\/learn\/author\/anastasiia-tomashivska"}]}},"_links":{"self":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"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=507"}],"version-history":[{"count":29,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":1244,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/posts\/507\/revisions\/1244"}],"wp:attachment":[{"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/plumrocket.com\/learn\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}