{"action":"created","issue":{"url":"https://api.github.com/repos/opencart/opencart/issues/5019","repository_url":"https://api.github.com/repos/opencart/opencart","labels_url":"https://api.github.com/repos/opencart/opencart/issues/5019/labels{/name}","comments_url":"https://api.github.com/repos/opencart/opencart/issues/5019/comments","events_url":"https://api.github.com/repos/opencart/opencart/issues/5019/events","html_url":"https://github.com/opencart/opencart/issues/5019","id":188996229,"number":5019,"title":"Rant: not using a `foreach` loop in language controller","user":{"login":"DRSDavidSoft","id":4673812,"avatar_url":"https://avatars.githubusercontent.com/u/4673812?v=3","gravatar_id":"","url":"https://api.github.com/users/DRSDavidSoft","html_url":"https://github.com/DRSDavidSoft","followers_url":"https://api.github.com/users/DRSDavidSoft/followers","following_url":"https://api.github.com/users/DRSDavidSoft/following{/other_user}","gists_url":"https://api.github.com/users/DRSDavidSoft/gists{/gist_id}","starred_url":"https://api.github.com/users/DRSDavidSoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DRSDavidSoft/subscriptions","organizations_url":"https://api.github.com/users/DRSDavidSoft/orgs","repos_url":"https://api.github.com/users/DRSDavidSoft/repos","events_url":"https://api.github.com/users/DRSDavidSoft/events{/privacy}","received_events_url":"https://api.github.com/users/DRSDavidSoft/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-11-13T21:27:26Z","updated_at":"2016-12-02T03:29:49Z","closed_at":null,"body":"I'm really curious, please one of the devs answer to this issue.\r\n\r\nThe controller files use the following logic to include language content:\r\n```\r\n$data['text_designer'] = $this->language->get('text_designer');\r\n$data['text_order'] = $this->language->get('text_order');\r\n$data['text_order_status'] = $this->language->get('text_order_status');\r\n$data['text_complete_status'] = $this->language->get('text_complete_status');\r\n$data['text_return'] = $this->language->get('text_return');\r\n$data['text_customer'] = $this->language->get('text_customer');\r\n$data['text_online'] = $this->language->get('text_online');\r\n$data['text_approval'] = $this->language->get('text_approval');\r\n$data['text_product'] = $this->language->get('text_product');\r\n$data['text_stock'] = $this->language->get('text_stock');\r\n$data['text_review'] = $this->language->get('text_review');\r\n$data['text_affiliate'] = $this->language->get('text_affiliate');\r\n$data['text_store'] = $this->language->get('text_store');\r\n$data['text_front'] = $this->language->get('text_front');\r\n$data['text_help'] = $this->language->get('text_help');\r\n$data['text_homepage'] = $this->language->get('text_homepage');\r\n$data['text_documentation'] = $this->language->get('text_documentation');\r\n$data['text_support'] = $this->language->get('text_support');\r\n```\r\n\r\nHowever, this method has a really bad side problem: If we want to add a new language field, we have to duplicate (i.e. copy and paste) a line, and change the variable **two** times.\r\n\r\nWhy OpenCart doesn't use the following format:\r\n```\r\n$lang_list = array( \r\n\t'text_designer',\r\n\t'text_order',\r\n\t'text_order_status',\r\n\t'text_complete_status',\r\n\t'text_return',\r\n\t'text_customer',\r\n\t'text_online',\r\n\t'text_approval',\r\n\t'text_product',\r\n\t'text_stock',\r\n\t'text_review',\r\n\t'text_affiliate',\r\n\t'text_store',\r\n\t'text_front',\r\n\t'text_help',\r\n\t'text_homepage',\r\n\t'text_documentation',\r\n\t'text_support'\r\n);\r\n\r\nforeach ( $lang_list as $node )\r\n\t$data[$node] = $this->language->get($node);\r\n```\r\n\r\nWhich is easier to maintain and understand, easier to add, remove or modify, and overall neater to do so.\r\n\r\nPlease, any of the original devs who wrote the controller code, answer to this issue. I really want to know!"},"comment":{"url":"https://api.github.com/repos/opencart/opencart/issues/comments/264364680","html_url":"https://github.com/opencart/opencart/issues/5019#issuecomment-264364680","issue_url":"https://api.github.com/repos/opencart/opencart/issues/5019","id":264364680,"user":{"login":"danielkerr","id":5079756,"avatar_url":"https://avatars.githubusercontent.com/u/5079756?v=3","gravatar_id":"","url":"https://api.github.com/users/danielkerr","html_url":"https://github.com/danielkerr","followers_url":"https://api.github.com/users/danielkerr/followers","following_url":"https://api.github.com/users/danielkerr/following{/other_user}","gists_url":"https://api.github.com/users/danielkerr/gists{/gist_id}","starred_url":"https://api.github.com/users/danielkerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielkerr/subscriptions","organizations_url":"https://api.github.com/users/danielkerr/orgs","repos_url":"https://api.github.com/users/danielkerr/repos","events_url":"https://api.github.com/users/danielkerr/events{/privacy}","received_events_url":"https://api.github.com/users/danielkerr/received_events","type":"User","site_admin":false},"created_at":"2016-12-02T03:29:49Z","updated_at":"2016-12-02T03:29:49Z","body":"im still fixing issues on the main site\r\nas soon as im finished will start working on changing thew dev stuff\r\n"}}
{"actor":{"display_login":"danielkerr"}}