{"action":"created","issue":{"url":"https://api.github.com/repos/i18next/i18next-express-middleware/issues/4","labels_url":"https://api.github.com/repos/i18next/i18next-express-middleware/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/i18next/i18next-express-middleware/issues/4/comments","events_url":"https://api.github.com/repos/i18next/i18next-express-middleware/issues/4/events","html_url":"https://github.com/i18next/i18next-express-middleware/issues/4","id":122403819,"number":4,"title":"Using together with sprintf postprocessor and overloadTranslationOptionHandler","user":{"login":"perrin4869","id":5774716,"avatar_url":"https://avatars.githubusercontent.com/u/5774716?v=3","gravatar_id":"","url":"https://api.github.com/users/perrin4869","html_url":"https://github.com/perrin4869","followers_url":"https://api.github.com/users/perrin4869/followers","following_url":"https://api.github.com/users/perrin4869/following{/other_user}","gists_url":"https://api.github.com/users/perrin4869/gists{/gist_id}","starred_url":"https://api.github.com/users/perrin4869/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perrin4869/subscriptions","organizations_url":"https://api.github.com/users/perrin4869/orgs","repos_url":"https://api.github.com/users/perrin4869/repos","events_url":"https://api.github.com/users/perrin4869/events{/privacy}","received_events_url":"https://api.github.com/users/perrin4869/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-16T01:04:35Z","updated_at":"2015-12-17T08:24:18Z","closed_at":null,"body":"I'm trying to get interpolations to work in `i18next 2.0`, in the browser I found no issue, but in `express` the following won't work:\r\n\r\n```javascript\r\ni18next.t('interpolationTest1', 'foo');\r\n```\r\neven when you have \r\n\r\n```javascript\r\ni18next.init({\r\n  overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler\r\n});\r\n```\r\nset.\r\n\r\nThe problem is here:\r\n\r\n```javascript\r\n    // assert t function returns always translation\r\n    // in given lng inside this request\r\n    let t = function(key, options) {\r\n      options = options || {};\r\n      options.lng = options.lng || req.lng;\r\n      return i18next.t(key, options);\r\n    };\r\n```\r\n\r\nin `src/index.js` in this repo, lines 20-26. Trying to set `options.lng` throws the following error\r\n\r\n```\r\nUnhandled rejection TypeError: Cannot assign to read only property 'lng' of foo\r\n```\r\n\r\nI'd make a pull request fixing this, seeing as the obvious fix is to use `options.overloadTranslationOptionHandler` to transform the options object, but I thought I'd confirm with you first :)"},"comment":{"url":"https://api.github.com/repos/i18next/i18next-express-middleware/issues/comments/165381721","html_url":"https://github.com/i18next/i18next-express-middleware/issues/4#issuecomment-165381721","issue_url":"https://api.github.com/repos/i18next/i18next-express-middleware/issues/4","id":165381721,"user":{"login":"jamuhl","id":977772,"avatar_url":"https://avatars.githubusercontent.com/u/977772?v=3","gravatar_id":"","url":"https://api.github.com/users/jamuhl","html_url":"https://github.com/jamuhl","followers_url":"https://api.github.com/users/jamuhl/followers","following_url":"https://api.github.com/users/jamuhl/following{/other_user}","gists_url":"https://api.github.com/users/jamuhl/gists{/gist_id}","starred_url":"https://api.github.com/users/jamuhl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamuhl/subscriptions","organizations_url":"https://api.github.com/users/jamuhl/orgs","repos_url":"https://api.github.com/users/jamuhl/repos","events_url":"https://api.github.com/users/jamuhl/events{/privacy}","received_events_url":"https://api.github.com/users/jamuhl/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T08:24:18Z","updated_at":"2015-12-17T08:24:18Z","body":"https://github.com/i18next/i18next/blob/master/src/Translator.js#L47 overloadOptions might be a little misleading naming...is more a overloadArgumentsToOptions ;) the overload gets only triggered if options is not an object - calling t with different arguments then t(key, opts)"}}