{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/8833","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/8833/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/8833/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/8833/events","html_url":"https://github.com/cakephp/cakephp/issues/8833","id":155180930,"number":8833,"title":"__ function returns array","user":{"login":"Zuluru","id":514172,"avatar_url":"https://avatars.githubusercontent.com/u/514172?v=3","gravatar_id":"","url":"https://api.github.com/users/Zuluru","html_url":"https://github.com/Zuluru","followers_url":"https://api.github.com/users/Zuluru/followers","following_url":"https://api.github.com/users/Zuluru/following{/other_user}","gists_url":"https://api.github.com/users/Zuluru/gists{/gist_id}","starred_url":"https://api.github.com/users/Zuluru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zuluru/subscriptions","organizations_url":"https://api.github.com/users/Zuluru/orgs","repos_url":"https://api.github.com/users/Zuluru/repos","events_url":"https://api.github.com/users/Zuluru/events{/privacy}","received_events_url":"https://api.github.com/users/Zuluru/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cakephp/cakephp/labels/Defect","name":"Defect","color":"f7c6c7"},{"url":"https://api.github.com/repos/cakephp/cakephp/labels/i18n","name":"i18n","color":"FFFFFF"}],"state":"open","locked":false,"assignee":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/69","html_url":"https://github.com/cakephp/cakephp/milestones/3.3.0","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/69/labels","id":1443324,"number":69,"title":"3.3.0","description":"A backwards compatible feature release for 3.x. See the [3.3 Roadmap](https://github.com/cakephp/cakephp/wiki/3.3-Roadmap)","creator":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"open_issues":79,"closed_issues":82,"state":"open","created_at":"2015-12-04T02:24:56Z","updated_at":"2016-05-19T13:54:00Z","due_on":"2016-07-24T04:00:00Z","closed_at":null},"comments":17,"created_at":"2016-05-17T05:39:35Z","updated_at":"2016-05-19T14:38:29Z","closed_at":null,"body":"This is a (multiple allowed):\r\n* [x] bug\r\n* [ ] enhancement\r\n* [ ] feature-discussion (RFC)\r\n\r\n* CakePHP Version: 3.2.8\r\n* Platform and Target: n/a, I think\r\n\r\nI'm running into a problem with the `__` function, and I'm not sure whether it's a bug in Cake, Aura\\Intl, or my code. I've tried the same thing in Cake 1.3, and it works as I expect it to, but it's possible that my expectations are simply that way because that's how it worked in 1.3. :-)\r\n\r\n### What you did\r\nWhen I am building my menus, I use things like `__('Teams')`, but I also have pages that use things like `__n('Team', 'Teams', count($player->teams))`. The i18n shell extracts these into the default.pot separately, so when I translate it to French, it's like this:\r\n\r\n    msgid \"Teams\"\r\n    msgstr \"Équipe\"\r\n\r\n    msgid \"Team\"\r\n    msgid_plural \"Teams\"\r\n    msgstr[0] \"Équipe\"\r\n    msgstr[1] \"Équipes\"\r\n\r\n### Expected Behavior\r\n`__('Team')` should return 'Équipe' and `__('Teams')` should return 'Équipes'.\r\n\r\n### Actual Behavior\r\nIf I call `__('Team')`, I correctly get 'Équipe' returned, and if I call `__n('Team', 'Teams', $x)`, I correctly get 'Équipe' or 'Équipes' returned, depending on the value of `$x`. But if I call `__('Teams')` I get back\r\n\r\n    Array\r\n    (\r\n        [0] => Équipe\r\n        [1] => Équipes\r\n    )\r\n\r\nThis is the case even if I eliminate the `msgid \"Teams\"` section, leaving only the plural definition.\r\n\r\nIn Cake 1.3, `__('Teams')` would simply return 'Équipes'. (Don't know what it might do in 2.x, as I skipped over that entirely.) So, whose bug is this? Posted this on [StackOverflow](http://stackoverflow.com/questions/37245525/cakephp-i18n-function-returns-array), and it was suggested that it looks like a bug to be reported here."},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/220344375","html_url":"https://github.com/cakephp/cakephp/issues/8833#issuecomment-220344375","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/8833","id":220344375,"user":{"login":"markstory","id":24086,"avatar_url":"https://avatars.githubusercontent.com/u/24086?v=3","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"created_at":"2016-05-19T14:38:29Z","updated_at":"2016-05-19T14:38:29Z","body":"> The best way we could do this is by changing the internal structure so we have many top level keys: normal, pluralized, and with context. That way you don't need to dynamically remove prefixes, and the lookups are easier to make depending of the function that was called. \r\n\r\n@lorenzo This is what I'm thinking as well. It will require changing internal structures, and how the Formatter classes work though."}}