{"action":"created","issue":{"url":"https://api.github.com/repos/mashpie/i18n-node/issues/238","repository_url":"https://api.github.com/repos/mashpie/i18n-node","labels_url":"https://api.github.com/repos/mashpie/i18n-node/issues/238/labels{/name}","comments_url":"https://api.github.com/repos/mashpie/i18n-node/issues/238/comments","events_url":"https://api.github.com/repos/mashpie/i18n-node/issues/238/events","html_url":"https://github.com/mashpie/i18n-node/issues/238","id":156054781,"number":238,"title":"Cannot set property 'locale' of undefined","user":{"login":"goowikns","id":5137567,"avatar_url":"https://avatars.githubusercontent.com/u/5137567?v=3","gravatar_id":"","url":"https://api.github.com/users/goowikns","html_url":"https://github.com/goowikns","followers_url":"https://api.github.com/users/goowikns/followers","following_url":"https://api.github.com/users/goowikns/following{/other_user}","gists_url":"https://api.github.com/users/goowikns/gists{/gist_id}","starred_url":"https://api.github.com/users/goowikns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goowikns/subscriptions","organizations_url":"https://api.github.com/users/goowikns/orgs","repos_url":"https://api.github.com/users/goowikns/repos","events_url":"https://api.github.com/users/goowikns/events{/privacy}","received_events_url":"https://api.github.com/users/goowikns/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-20T21:30:21Z","updated_at":"2016-05-21T11:28:50Z","closed_at":null,"body":"I get following error:\r\n```\r\nCannot set property 'locale' of undefined\r\nTypeError: Cannot set property 'locale' of undefined\r\n    at Object.i18nSetLocale [as setLocale] (C:\\Users\\...\\project\\node_modules\\i18n\\i18n.js:404:25)\r\n    at C:\\Users\\...\\project\\app.js:67:10\r\n    at Layer.handle [as handle_request] (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\layer.js:95:5)\r\n    at trim_prefix (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:312:13)\r\n    at C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:280:7\r\n    at Function.process_params (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:330:12)\r\n    at next (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:271:10)\r\n    at i18nInit (C:\\Users\\...\\project\\node_modules\\i18n\\i18n.js:201:14)\r\n    at Layer.handle [as handle_request] (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\layer.js:95:5)\r\n    at trim_prefix (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:312:13)\r\n    at C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:280:7\r\n    at Function.process_params (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:330:12)\r\n    at next (C:\\Users\\...\\project\\node_modules\\express\\lib\\router\\index.js:271:10)\r\n    at SendStream.error (C:\\Users\\...\\project\\node_modules\\express\\node_modules\\serve-static\\index.js:120:7)\r\n    at emitOne (events.js:77:13)\r\n    at SendStream.emit (events.js:169:7)\r\n    at SendStream.error (C:\\Users\\...\\project\\node_modules\\express\\node_modules\\send\\index.js:245:17)\r\n    at SendStream.onStatError (C:\\Users\\...\\project\\node_modules\\express\\node_modules\\send\\index.js:356:12)\r\n    at next (C:\\Users\\...\\project\\node_modules\\express\\node_modules\\send\\index.js:658:28)\r\n    at C:\\Users\\...\\project\\node_modules\\express\\node_modules\\send\\index.js:666:23\r\n    at FSReqWrap.oncomplete (fs.js:82:15)\r\n```\r\n\r\n**Here is my code:**\r\n\r\n```\r\ni18n.configure({\r\n  locales: ['nl', 'fr'],\r\n  register: global,\r\n  cookie: 'gmlang',\r\n  directory: __dirname + '/locales',\r\n  defaultLocale: 'nl'\r\n});\r\n\r\napp.use(i18n.init);\r\n\r\napp.use(function (req, res, next) {\r\n  console.log(i18n);\r\n  if (req.query.lang != undefined && i18n.locales.indexOf(req.query.lang) >= 0) {\r\n    i18n.setLocale(req.query.lang);\r\n  }else{\r\n    i18n.setLocale(i18n.defaultLocale);\r\n  }\r\n  next();\r\n});\r\n```\r\n\r\nWhen logging the i18n I also get an empty locales object:\r\n```\r\n{ locales: {},\r\n  version: '0.8.2',\r\n  configure: [Function: i18nConfigure],\r\n  init: [Function: i18nInit],\r\n  __: [Function: i18nTranslate],\r\n  __mf: [Function: i18nMessageformat],\r\n  __l: [Function: i18nTranslationList],\r\n  __h: [Function: i18nTranslationHash],\r\n  __n: [Function: i18nTranslatePlural],\r\n  setLocale: [Function: i18nSetLocale],\r\n  getLocale: [Function: i18nGetLocale],\r\n  getCatalog: [Function: i18nGetCatalog],\r\n  getLocales: [Function: i18nGetLocales],\r\n  addLocale: [Function: i18nAddLocale],\r\n  removeLocale: [Function: i18nRemoveLocale] }\r\n```\r\n\r\nAny ideas?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mashpie/i18n-node/issues/comments/220772707","html_url":"https://github.com/mashpie/i18n-node/issues/238#issuecomment-220772707","issue_url":"https://api.github.com/repos/mashpie/i18n-node/issues/238","id":220772707,"user":{"login":"mashpie","id":118508,"avatar_url":"https://avatars.githubusercontent.com/u/118508?v=3","gravatar_id":"","url":"https://api.github.com/users/mashpie","html_url":"https://github.com/mashpie","followers_url":"https://api.github.com/users/mashpie/followers","following_url":"https://api.github.com/users/mashpie/following{/other_user}","gists_url":"https://api.github.com/users/mashpie/gists{/gist_id}","starred_url":"https://api.github.com/users/mashpie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mashpie/subscriptions","organizations_url":"https://api.github.com/users/mashpie/orgs","repos_url":"https://api.github.com/users/mashpie/repos","events_url":"https://api.github.com/users/mashpie/events{/privacy}","received_events_url":"https://api.github.com/users/mashpie/received_events","type":"User","site_admin":false},"created_at":"2016-05-21T11:28:50Z","updated_at":"2016-05-21T11:28:50Z","body":"but invalid! Nativ JSON has no support for comments. Remove you comments and check again."}}
{"actor":{"display_login":"mashpie"}}