{"id":64947,"date":"2016-11-18T14:20:18","date_gmt":"2016-11-18T14:20:18","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=64947"},"modified":"2016-11-18T14:20:18","modified_gmt":"2016-11-18T14:20:18","slug":"not-using-en-gb-language-folder-oc-2-2-x","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/","title":{"rendered":"Not using en-gb language folder in OC 2.2.x +?"},"content":{"rendered":"<p>Have you ever wondered, even on using the english\u00a0folder in place of en-gb in Opencart 2.2.x and upper, you get the correct language in the controller? Here&#8217;s the reason for this. If you look at the language library&#8217;s load function then you will get to know\u00a0why this is happening.<\/p>\n<pre class=\"brush:php\">public function load($filename, &amp;$data = array()) {\r\n\t$_ = array();\r\n\r\n\t$file = DIR_LANGUAGE . 'english\/' . $filename . '.php';\r\n\t\r\n\tif (is_file($file)) {\r\n\t\trequire($file);\r\n\t}\r\n\r\n\t$file = DIR_LANGUAGE . $this-&gt;default . '\/' . $filename . '.php';\r\n\r\n\tif (is_file($file)) {\r\n\t\trequire($file);\r\n\t}\r\n\r\n\t$file = DIR_LANGUAGE . $this-&gt;directory . '\/' . $filename . '.php';\r\n\r\n\tif (is_file($file)) {\r\n\t\trequire($file);\r\n\t}\r\n\r\n\t$this-&gt;data = array_merge($this-&gt;data, $_);\r\n\r\n\treturn $this-&gt;data;\r\n}<\/pre>\n<p>It loads the file existing in the &#8220;english&#8221; folder by default. After loading the file from the english folder, it loads the default file of currently selected language. And after that, it loads the language file that is mentioned by the developer in the code. So, after loading all the files, the $data array is merged with the $_ array in the language file in which all the languages are stored. Hope, by this, you would also understand the concept of $_ array in the language file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wondered, even on using the english\u00a0folder in place of en-gb in Opencart 2.2.x and upper, you get the correct language in the controller? Here&#8217;s the reason for this. If you look at the language library&#8217;s load function then you will get to know\u00a0why this is happening. public function load($filename, &amp;$data = array()) <a href=\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":70,"featured_media":41008,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[305],"tags":[4025,1803,2071],"class_list":["post-64947","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-opencart","tag-en-gb","tag-language","tag-opencart"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Not using en-gb language folder in OC 2.2.x +? - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Not using en-gb language folder in OC 2.2.x +? - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Have you ever wondered, even on using the english\u00a0folder in place of en-gb in Opencart 2.2.x and upper, you get the correct language in the controller? Here&#8217;s the reason for this. If you look at the language library&#8217;s load function then you will get to know\u00a0why this is happening. public function load($filename, &amp;$data = array()) [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-18T14:20:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vikhyat Sharma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vikhyat Sharma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\"},\"author\":{\"name\":\"Vikhyat Sharma\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0\"},\"headline\":\"Not using en-gb language folder in OC 2.2.x +?\",\"datePublished\":\"2016-11-18T14:20:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\"},\"wordCount\":144,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"keywords\":[\"en-gb\",\"language\",\"opencart\"],\"articleSection\":[\"opencart\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\",\"url\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\",\"name\":\"Not using en-gb language folder in OC 2.2.x +? - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"datePublished\":\"2016-11-18T14:20:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Not using en-gb language folder in OC 2.2.x +?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0\",\"name\":\"Vikhyat Sharma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Vikhyat Sharma\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/vikhyat-sharma83\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Not using en-gb language folder in OC 2.2.x +? - Webkul Blog","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:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/","og_locale":"en_US","og_type":"article","og_title":"Not using en-gb language folder in OC 2.2.x +? - Webkul Blog","og_description":"Have you ever wondered, even on using the english\u00a0folder in place of en-gb in Opencart 2.2.x and upper, you get the correct language in the controller? Here&#8217;s the reason for this. If you look at the language library&#8217;s load function then you will get to know\u00a0why this is happening. public function load($filename, &amp;$data = array()) [...]","og_url":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2016-11-18T14:20:18+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","type":"image\/png"}],"author":"Vikhyat Sharma","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Vikhyat Sharma","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/"},"author":{"name":"Vikhyat Sharma","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0"},"headline":"Not using en-gb language folder in OC 2.2.x +?","datePublished":"2016-11-18T14:20:18+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/"},"wordCount":144,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","keywords":["en-gb","language","opencart"],"articleSection":["opencart"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/","url":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/","name":"Not using en-gb language folder in OC 2.2.x +? - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","datePublished":"2016-11-18T14:20:18+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/02\/Opencart-Code-Snippet.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/not-using-en-gb-language-folder-oc-2-2-x\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Not using en-gb language folder in OC 2.2.x +?"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/af7160d2546c64a1856ab1b5ce77d9b0","name":"Vikhyat Sharma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7c9c700cc2d7120c9faf1ab3392b4e533808ba197f58c0441d6caecc68179e12?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Vikhyat Sharma"},"url":"https:\/\/webkul.com\/blog\/author\/vikhyat-sharma83\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/64947","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/70"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=64947"}],"version-history":[{"count":1,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/64947\/revisions"}],"predecessor-version":[{"id":64960,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/64947\/revisions\/64960"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/41008"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=64947"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=64947"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=64947"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}