{"id":72088,"date":"2016-06-14T09:03:01","date_gmt":"2016-06-14T13:03:01","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=72088"},"modified":"2016-07-14T04:39:16","modified_gmt":"2016-07-14T08:39:16","slug":"shopify-how-to-create-locale-files","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/shopify-how-to-create-locale-files.html","title":{"rendered":"Shopify. How to create locale files"},"content":{"rendered":"<p>This guide will show you how to create locale files in Shopify.<\/p>\r\n <div class=\"video-container\">\r\n\t<iframe src=\"https:\/\/www.youtube.com\/embed\/4hOL-V55Hoo\"><\/iframe>\r\n<\/div>\r\n<p>A locale file is a .json file that contains a set of translations for the text strings used in a theme template file. A separate locale file is used for every language that&#8217;s available in the theme. Locale files are stored in the Locales section of the theme editor.<\/p>\r\n<p>Instead of hard-coded text strings, theme template files use the <a target='_blank' href='https:\/\/docs.shopify.com\/themes\/development\/internationalizing\/translation-filter'>translation keys<\/a> and pass them to the translation filter (or t filter.)<\/p>\r\n<p>The translation filter retrieves the appropriate translated string from the locale file for the <a target='_blank' href='https:\/\/docs.shopify.com\/manual\/sell-online\/checkout-settings\/translate-checkout'>active<\/a> language. <\/p>\r\n<p>You can generate a locale file in a number of ways: by clicking on <strong>Add a new locale<\/strong> from the theme template editor or by creating a new locale file manually.<\/p>\r\n\r\n<p>To add a new locale from the <strong>Edit HTML\/CSS<\/strong> page:<\/p>\r\n\r\n<ol>\r\n\t<li>        \r\n        <p>From your Shopify admin, click on <strong>Online Store<\/strong>, then click on <strong>Themes<\/strong><\/p>\r\n        \r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files1-195x300.jpg\" alt=\"Shopify._How_to_create_locale_files1\" width=\"195\" height=\"300\" class=\"alignnone size-medium wp-image-72089\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files1-195x300.jpg 195w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files1-98x150.jpg 98w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files1.jpg 248w\" sizes=\"(max-width: 195px) 100vw, 195px\" \/><\/a>        \r\n\t\t<p>Find the theme you want to edit, press the <strong>&#8230;<\/strong> button and then click on <strong>Edit HTML\/CSS<\/strong>:<\/p>\r\n        \r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files2-300x192.jpg\" alt=\"Shopify._How_to_create_locale_files2\" width=\"300\" height=\"192\" class=\"alignnone size-medium wp-image-72090\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files2-300x192.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files2-150x96.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files2.jpg 433w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>        \r\n\t\t<p>Scroll down the sidebar and click on <strong>Locales<\/strong>, then choose <strong>Add a new locale<\/strong>.<\/p>\r\n\t\t\r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files3.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files3-300x108.jpg\" alt=\"Shopify._How_to_create_locale_files3\" width=\"300\" height=\"108\" class=\"alignnone size-medium wp-image-72091\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files3-300x108.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files3-150x54.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files3.jpg 641w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\t\t \r\n         <p>From the drop-down, select an existing locale file as a starting point or create a new one from scratch. Enter a name for the locale file (without the .json extension), then press <strong>Create locale<\/strong>.<\/p>\r\n    <\/li>\r\n    <li>\r\n         <p><strong>Creating a new locale file manually<\/strong>:<\/p>\r\n         <p>If you create a locale file manually (that&#8217;s outside the theme editor), be sure to use the correct IETF language tag for the filename.<\/p>\r\n         <p><strong>Where to save your locale files<\/strong>:<\/p>\r\n         <p>Save your locale files in the <strong>\/locales<\/strong> folder, which is accessible from the Template Editor.<\/p>\r\n\t\t \r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files4.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files4.jpg\" alt=\"Shopify._How_to_create_locale_files4\" width=\"261\" height=\"260\" class=\"alignnone size-full wp-image-72092\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files4.jpg 261w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files4-150x150.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2016\/06\/Shopify._How_to_create_locale_files4-164x164.jpg 164w\" sizes=\"(max-width: 261px) 100vw, 261px\" \/><\/a>    <\/li>\r\n    <li><p><strong>Naming locale files<\/strong>: when naming new locale files, you must follow the standard <a target='_blank' rel=\"nofollow\" href=\"http:\/\/en.wikipedia.org\/wiki\/IETF_language_tag\">IETF language tag nomenclature<\/a>,  where the first lowercase letter code represents the language, and the second uppercase code represents the region, for example:\r\n       <\/p>\r\n       <p><strong>fr-CA.json<\/strong> for French &#8211; Canada, <strong>en-GB.json<\/strong> for English &#8211; Great Britain, <strong>es-ES.json<\/strong> for Spanish &#8211; Spain.<\/p>\r\n       <p>If a language isn&#8217;t region-specific, you can use only the 2-letter language representation of the IETF language tag, for example: <strong>fi.json<\/strong> for Finnish &#8211; All Regions.<\/p>\r\n    <\/li> \r\n    <li>\r\n        <p><strong>The default locale file<\/strong>: you must designate a default locale file, *.default.json. The default locale file contains the translations for the default language of your theme. Only one default file is permitted, which by default is en.default.json (English).\r\n       <\/p>\r\n    <\/li>  \r\n    <li>\r\n    <p><strong>Values<\/strong>: values can contain HTML and Liquid objects (through interpolation.) You should limit the presence of these elements in the translation files, to ensure a simple translation process for merchants creating an additional language.<\/p>\r\n    <p>In some cases, you might have to include template elements in the values, to accommodate linguistic and grammatical differences, for example:<\/p>\r\n    <ul class=\"list\">\r\n    <li>English &#8211; Posted by {{author}} on {{ date }}<\/li>\r\n    <li>French &#8211; Publi\u00e9 le {{ date }} par {{ author }}<\/li>\r\n    <\/ul>\r\n    <\/li>       \r\n<\/ol>\r\n<p>This is the end of the tutorial. Now you know how to create locale files.<\/p> \r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<a href=\"http:\/\/www.youtube.com\/watch?v=4hOL-V55Hoo?width=1280&amp;height=720\" rel=\"prettyPhoto\">Shopify. How to create locale files<\/a>","protected":false},"excerpt":{"rendered":"<p>This guide will show you how to create locale files in Shopify.<\/p>\n","protected":false},"author":61,"featured_media":72093,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1771],"tags":[2306,702,2419],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/72088"}],"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\/61"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=72088"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/72088\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/72093"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=72088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=72088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=72088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}