{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/18314","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/18314/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18314/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/18314/events","html_url":"https://github.com/symfony/symfony/pull/18314","id":143533695,"number":18314,"title":"[WIP][Translation] allow using multiple formatters with decoupling the def…","user":{"login":"aitboudad","id":1753742,"avatar_url":"https://avatars.githubusercontent.com/u/1753742?v=3","gravatar_id":"","url":"https://api.github.com/users/aitboudad","html_url":"https://github.com/aitboudad","followers_url":"https://api.github.com/users/aitboudad/followers","following_url":"https://api.github.com/users/aitboudad/following{/other_user}","gists_url":"https://api.github.com/users/aitboudad/gists{/gist_id}","starred_url":"https://api.github.com/users/aitboudad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aitboudad/subscriptions","organizations_url":"https://api.github.com/users/aitboudad/orgs","repos_url":"https://api.github.com/users/aitboudad/repos","events_url":"https://api.github.com/users/aitboudad/events{/privacy}","received_events_url":"https://api.github.com/users/aitboudad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Needs%20Review","name":"Status: Needs Review","color":"ededed"},{"url":"https://api.github.com/repos/symfony/symfony/labels/Translator","name":"Translator","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-25T16:19:11Z","updated_at":"2016-03-25T16:29:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18314","html_url":"https://github.com/symfony/symfony/pull/18314","diff_url":"https://github.com/symfony/symfony/pull/18314.diff","patch_url":"https://github.com/symfony/symfony/pull/18314.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | master\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | yes\r\n| Deprecations? | yes\r\n| Tests pass?   | yes\r\n| Fixed tickets |  #6009, #10152, one item in #11742, #11948\r\n| License       | MIT\r\n| Doc PR        | ~\r\n\r\n#### Summary:\r\n\r\n-  Translation formatting splitted into two class TransChoiceMessageFormatter, TransMessageFormatter.\r\n- Deprecated [transChoice](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Translation/TranslatorInterface.php#L48) in favor of  [trans](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Translation/TranslatorInterface.php#L33) method\r\n- Allow using multiple formatters in a single translator.\r\n\r\n##### Before\r\n```php\r\n$translator->trans('Hello World!');\r\n$translator->transChoice('some_message2', 10, array('%count%' => 10));\r\n```\r\n\r\n##### After\r\n```php\r\n// use the default formatter\r\n$translator->trans('Hello World!'); \r\n// use transchoice\r\n$translator->trans('Hello World!', [], 'menu', 'fr', TransChoiceMessageFormatter::NAME);\r\n// use intl\r\n$translator->trans('Hello World!', [], 'menu', 'fr', IntlMessageFormatter::NAME);\r\n```\r\n\r\n**Before continuing my work, please tell me what do you think about the current approach ? thanks**\r\n"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/201351894","html_url":"https://github.com/symfony/symfony/pull/18314#issuecomment-201351894","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18314","id":201351894,"user":{"login":"Nicofuma","id":591456,"avatar_url":"https://avatars.githubusercontent.com/u/591456?v=3","gravatar_id":"","url":"https://api.github.com/users/Nicofuma","html_url":"https://github.com/Nicofuma","followers_url":"https://api.github.com/users/Nicofuma/followers","following_url":"https://api.github.com/users/Nicofuma/following{/other_user}","gists_url":"https://api.github.com/users/Nicofuma/gists{/gist_id}","starred_url":"https://api.github.com/users/Nicofuma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nicofuma/subscriptions","organizations_url":"https://api.github.com/users/Nicofuma/orgs","repos_url":"https://api.github.com/users/Nicofuma/repos","events_url":"https://api.github.com/users/Nicofuma/events{/privacy}","received_events_url":"https://api.github.com/users/Nicofuma/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T16:29:27Z","updated_at":"2016-03-25T16:29:27Z","body":"What will be the replacement for `$translator->transChoice('some_message2', 10, array('%count%' => 10));` ?\r\n\r\n`$translator->trans('some_message2', ['__number__' => 10, '%count%' => 10], null, null, TransChoiceMessageFormatter::NAME);` ?\r\n\r\nIt looks a bit weird to me. I think that if trans and transChoice are merged together we should have a way to automatically choose between the 2 (maybe automatically takes a '%count%' key is their isn't any '__number__' one or something like that?)"}}