{"action":"created","issue":{"url":"https://api.github.com/repos/Sylius/Sylius/issues/2519","labels_url":"https://api.github.com/repos/Sylius/Sylius/issues/2519/labels{/name}","comments_url":"https://api.github.com/repos/Sylius/Sylius/issues/2519/comments","events_url":"https://api.github.com/repos/Sylius/Sylius/issues/2519/events","html_url":"https://github.com/Sylius/Sylius/pull/2519","id":59039516,"number":2519,"title":"Rework translations handling","user":{"login":"pjedrzejewski","id":614970,"avatar_url":"https://avatars.githubusercontent.com/u/614970?v=3","gravatar_id":"","url":"https://api.github.com/users/pjedrzejewski","html_url":"https://github.com/pjedrzejewski","followers_url":"https://api.github.com/users/pjedrzejewski/followers","following_url":"https://api.github.com/users/pjedrzejewski/following{/other_user}","gists_url":"https://api.github.com/users/pjedrzejewski/gists{/gist_id}","starred_url":"https://api.github.com/users/pjedrzejewski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjedrzejewski/subscriptions","organizations_url":"https://api.github.com/users/pjedrzejewski/orgs","repos_url":"https://api.github.com/users/pjedrzejewski/repos","events_url":"https://api.github.com/users/pjedrzejewski/events{/privacy}","received_events_url":"https://api.github.com/users/pjedrzejewski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-02-26T08:54:15Z","updated_at":"2015-02-27T13:07:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Sylius/Sylius/pulls/2519","html_url":"https://github.com/Sylius/Sylius/pull/2519","diff_url":"https://github.com/Sylius/Sylius/pull/2519.diff","patch_url":"https://github.com/Sylius/Sylius/pull/2519.patch"},"body":"| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | yes\r\n| New feature?  | yes\r\n| BC breaks?    | yes\r\n| Deprecations? | no\r\n| Fixed tickets | #2491 #2447 \r\n| License       | MIT\r\n\r\nHey folks!\r\n\r\nThis PR decouples ResourceBundle from TranslationBundle, keeping them standalone.\r\n\r\nBasically, TranslationBundle becomes an extension of ResourceBundle, which you can install if you want to translate your resources.\r\n\r\nAlso, it cleans up the configuration a bit, before:\r\n\r\n``` yaml\r\nsylius_product:\r\n    driver: doctrine/orm\r\n    classes:\r\n        product:\r\n            model: Your\\Product\r\n            controller: Your\\ProductController\r\n            repository: Your\\ProductRepository\r\n            form:\r\n                default: Your\\ProductType\r\n            translatable:\r\n                targetEntity: Your\\ProductTranslation\r\n                translatable_fields: [name, banana]\r\n        product_translation:\r\n            model: Your\\ProductTranslation\r\n            controller: ~\r\n            repository: ~\r\n            form:\r\n                default: Your\\ProductTranslationType\r\n```\r\n\r\nAfter:\r\n\r\n``` yaml\r\nsylius_product:\r\n    driver: doctrine/orm\r\n    classes:\r\n        product:\r\n            model: Your\\Product\r\n            controller: Your\\ProductController\r\n            repository: Your\\ProductRepository\r\n            form:\r\n                default: Your\\ProductType\r\n            translation:\r\n                model: Your\\ProductTranslation\r\n                controller: ~\r\n                repository: ~\r\n                form:\r\n                    default: Your\\ProductTranslationType\r\n                mapping:\r\n                    fields: [name, banana]\r\n```\r\n\r\nSyliusResourceBundle will automatically map this to 2 resources: ``sylius.product`` and ``sylius.product_translation``. Translation has all the perks as normal resource.\r\nIf you do not have SyliusTranslationBundle registered, it will simply ignore this configuration. The circular dependency has been removed:\r\n\r\nSyliusResourceBundle requires Resource\r\nTranslation requires Resource\r\nSyliusTranslationBundle requires SyliusResourceBundle and Translation\r\n\r\nI have also dropped the dependency on ``locale.context``, now TranslationBundle has its own LocaleProvider, which can have different implementations:\r\n\r\nIn Translation component - Return hardcoded locale\r\nIn TranslationBundle - Return locale from current request\r\nIn CoreBundle - Get locale from ``locale.context``\r\n\r\nThings left to do:\r\n\r\n* [ ] Make all scenarios green\r\n* [x] Fix few specs\r\n* [x] Allow same thing in SyliusResourceBundle ``resources`` configuration\r\n* [x] Rename CurrentLocaleProviderInterface to LocaleProviderInterface\r\n* [x] Update MongoDB driver\r\n\r\nFeedback appreciated!"},"comment":{"url":"https://api.github.com/repos/Sylius/Sylius/issues/comments/76391504","html_url":"https://github.com/Sylius/Sylius/pull/2519#issuecomment-76391504","issue_url":"https://api.github.com/repos/Sylius/Sylius/issues/2519","id":76391504,"user":{"login":"gonzalovilaseca","id":4030438,"avatar_url":"https://avatars.githubusercontent.com/u/4030438?v=3","gravatar_id":"","url":"https://api.github.com/users/gonzalovilaseca","html_url":"https://github.com/gonzalovilaseca","followers_url":"https://api.github.com/users/gonzalovilaseca/followers","following_url":"https://api.github.com/users/gonzalovilaseca/following{/other_user}","gists_url":"https://api.github.com/users/gonzalovilaseca/gists{/gist_id}","starred_url":"https://api.github.com/users/gonzalovilaseca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonzalovilaseca/subscriptions","organizations_url":"https://api.github.com/users/gonzalovilaseca/orgs","repos_url":"https://api.github.com/users/gonzalovilaseca/repos","events_url":"https://api.github.com/users/gonzalovilaseca/events{/privacy}","received_events_url":"https://api.github.com/users/gonzalovilaseca/received_events","type":"User","site_admin":false},"created_at":"2015-02-27T13:07:02Z","updated_at":"2015-02-27T13:07:02Z","body":"@pjedrzejewski Probably yes, I will have a look. "}}