{"action":"created","comment":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/comments/235883429","pull_request_review_id":177853428,"id":235883429,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTg4MzQyOQ==","diff_hunk":"@@ -0,0 +1,161 @@\n+Creating a locale switcher\n+==========================\n+\n+This is a full working example of creating a locale switcher.\n+\n+.. note::\n+    This article assumes you are using Symfony 4, Flex, and autowiring.\n+\n+Prerequisites\n+-------------\n+\n+Install following Sonata dependencies:\n+\n+* `Sonata Easy-Extends Bundle`_\n+* `Sonata Intl Bundle`_\n+\n+Create ``LocaleSubscriber`` and ``UserLocaleSubscriber`` as explained `here`_.\n+\n+.. note::\n+    Sonata Intl Bundle is optional, but will allow list of locales to be shown as list of languages.\n+\n+Handle locale switch\n+--------------------\n+\n+Create a controller to handle locale switch in ``src/Controller/LocaleController.php``:\n+\n+.. code-block:: php\n+\n+    <?php\n+\n+    namespace App\\Controller;\n+\n+    use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;\n+    use Symfony\\Component\\Routing\\Annotation\\Route;\n+    use Symfony\\Component\\HttpFoundation\\Request;\n+    use Symfony\\Component\\HttpFoundation\\Session\\SessionInterface;\n+    use Symfony\\Component\\HttpFoundation\\RedirectResponse;\n+\n+    class LocaleController extends AbstractController\n+    {\n+        /**\n+        * @Route(\"/locale/{locale}\", name=\"locale\")\n+        */\n+        public function index(Request $request, SessionInterface $session, $locale)\n+        {\n+            $session->set('_locale', $locale);\n+            $referer = $request->headers->get('referer');\n+            return new RedirectResponse($referer ?: '/');\n+        }\n+    }\n+\n+Extend SonataAdminBundle\n+------------------------\n+\n+Open a command console, enter your project directory and execute the\n+following command:\n+\n+.. code-block:: bash\n+\n+    $ bin/console sonata:easy-extends:generate SonataAdminBundle --dest=src --namespace_prefix=App","path":"docs/cookbook/recipe_creating_a_locale_switcher.rst","position":60,"original_position":60,"commit_id":"d03cfa6461efb4858181adcd12d1e39d61b0303a","original_commit_id":"d03cfa6461efb4858181adcd12d1e39d61b0303a","user":{"login":"kunicmarko20","id":13528674,"node_id":"MDQ6VXNlcjEzNTI4Njc0","avatar_url":"https://avatars3.githubusercontent.com/u/13528674?v=4","gravatar_id":"","url":"https://api.github.com/users/kunicmarko20","html_url":"https://github.com/kunicmarko20","followers_url":"https://api.github.com/users/kunicmarko20/followers","following_url":"https://api.github.com/users/kunicmarko20/following{/other_user}","gists_url":"https://api.github.com/users/kunicmarko20/gists{/gist_id}","starred_url":"https://api.github.com/users/kunicmarko20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunicmarko20/subscriptions","organizations_url":"https://api.github.com/users/kunicmarko20/orgs","repos_url":"https://api.github.com/users/kunicmarko20/repos","events_url":"https://api.github.com/users/kunicmarko20/events{/privacy}","received_events_url":"https://api.github.com/users/kunicmarko20/received_events","type":"User","site_admin":false},"body":" I think this part is not really needed, you can just create a template in your own directory.","created_at":"2018-11-23T09:33:42Z","updated_at":"2018-11-23T09:33:42Z","html_url":"https://github.com/sonata-project/SonataAdminBundle/pull/5309#discussion_r235883429","pull_request_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/comments/235883429"},"html":{"href":"https://github.com/sonata-project/SonataAdminBundle/pull/5309#discussion_r235883429"},"pull_request":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309"}}},"pull_request":{"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309","id":233060005,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMDYwMDA1","html_url":"https://github.com/sonata-project/SonataAdminBundle/pull/5309","diff_url":"https://github.com/sonata-project/SonataAdminBundle/pull/5309.diff","patch_url":"https://github.com/sonata-project/SonataAdminBundle/pull/5309.patch","issue_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/5309","number":5309,"state":"open","locked":false,"title":"Document creating locale switcher","user":{"login":"jo66","id":8778108,"node_id":"MDQ6VXNlcjg3NzgxMDg=","avatar_url":"https://avatars2.githubusercontent.com/u/8778108?v=4","gravatar_id":"","url":"https://api.github.com/users/jo66","html_url":"https://github.com/jo66","followers_url":"https://api.github.com/users/jo66/followers","following_url":"https://api.github.com/users/jo66/following{/other_user}","gists_url":"https://api.github.com/users/jo66/gists{/gist_id}","starred_url":"https://api.github.com/users/jo66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jo66/subscriptions","organizations_url":"https://api.github.com/users/jo66/orgs","repos_url":"https://api.github.com/users/jo66/repos","events_url":"https://api.github.com/users/jo66/events{/privacy}","received_events_url":"https://api.github.com/users/jo66/received_events","type":"User","site_admin":false},"body":"<!-- THE PR TEMPLATE IS NOT AN OPTION. DO NOT DELETE IT, MAKE SURE YOU READ AND EDIT IT! -->\r\n\r\n<!--\r\n    Show us you choose the right branch.\r\n    Different branches are used for different things :\r\n    - 3.x is for everything backwards compatible, like patches, features and deprecation notices\r\n    - master is for deprecation removals and other changes that cannot be done without a BC-break\r\n    More details here: https://github.com/sonata-project/SonataAdminBundle/blob/3.x/CONTRIBUTING.md#the-base-branch\r\n-->\r\nI am targeting this branch, because documenting should be backwards compatible.\r\n\r\n<!--\r\n    Specify which issues will be fixed/closed.\r\n    Remove it if this is not related.\r\n-->\r\n\r\n\r\n\r\n<!-- MANDATORY\r\n    Fill the changelog part inside the code block.\r\n    Follow this schema: http://keepachangelog.com/\r\n-->\r\n\r\n<!-- \r\n    If you are updating something that doesn't require\r\n    a release, you can delete whole Changelog section.\r\n    (eg. update to docs, tests)\r\n-->\r\n\r\n<!--\r\n    If this is a work in progress, uncomment this section.\r\n    You can add as many tasks as you want.\r\n    If some are not relevant, just remove them.\r\n    \r\n    ## To do\r\n    \r\n    - [ ] Update the tests\r\n    - [ ] Update the documentation\r\n    - [ ] Add an upgrade note\r\n-->\r\n\r\n## Subject\r\n\r\n<!-- Describe your Pull Request content here -->\r\nAdd documentation about creating a locale switcher.","created_at":"2018-11-22T19:12:30Z","updated_at":"2018-11-23T09:33:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"177cbb309d59ca5cded645c136d8ce0e0a1cf819","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309/commits","review_comments_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309/comments","review_comment_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/5309/comments","statuses_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/statuses/d03cfa6461efb4858181adcd12d1e39d61b0303a","head":{"label":"jo66:document-locale-switcher","ref":"document-locale-switcher","sha":"d03cfa6461efb4858181adcd12d1e39d61b0303a","user":{"login":"jo66","id":8778108,"node_id":"MDQ6VXNlcjg3NzgxMDg=","avatar_url":"https://avatars2.githubusercontent.com/u/8778108?v=4","gravatar_id":"","url":"https://api.github.com/users/jo66","html_url":"https://github.com/jo66","followers_url":"https://api.github.com/users/jo66/followers","following_url":"https://api.github.com/users/jo66/following{/other_user}","gists_url":"https://api.github.com/users/jo66/gists{/gist_id}","starred_url":"https://api.github.com/users/jo66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jo66/subscriptions","organizations_url":"https://api.github.com/users/jo66/orgs","repos_url":"https://api.github.com/users/jo66/repos","events_url":"https://api.github.com/users/jo66/events{/privacy}","received_events_url":"https://api.github.com/users/jo66/received_events","type":"User","site_admin":false},"repo":{"id":158727746,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg3Mjc3NDY=","name":"SonataAdminBundle","full_name":"jo66/SonataAdminBundle","private":false,"owner":{"login":"jo66","id":8778108,"node_id":"MDQ6VXNlcjg3NzgxMDg=","avatar_url":"https://avatars2.githubusercontent.com/u/8778108?v=4","gravatar_id":"","url":"https://api.github.com/users/jo66","html_url":"https://github.com/jo66","followers_url":"https://api.github.com/users/jo66/followers","following_url":"https://api.github.com/users/jo66/following{/other_user}","gists_url":"https://api.github.com/users/jo66/gists{/gist_id}","starred_url":"https://api.github.com/users/jo66/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jo66/subscriptions","organizations_url":"https://api.github.com/users/jo66/orgs","repos_url":"https://api.github.com/users/jo66/repos","events_url":"https://api.github.com/users/jo66/events{/privacy}","received_events_url":"https://api.github.com/users/jo66/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jo66/SonataAdminBundle","description":"AdminBundle - The missing Symfony Admin Generator","fork":true,"url":"https://api.github.com/repos/jo66/SonataAdminBundle","forks_url":"https://api.github.com/repos/jo66/SonataAdminBundle/forks","keys_url":"https://api.github.com/repos/jo66/SonataAdminBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jo66/SonataAdminBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jo66/SonataAdminBundle/teams","hooks_url":"https://api.github.com/repos/jo66/SonataAdminBundle/hooks","issue_events_url":"https://api.github.com/repos/jo66/SonataAdminBundle/issues/events{/number}","events_url":"https://api.github.com/repos/jo66/SonataAdminBundle/events","assignees_url":"https://api.github.com/repos/jo66/SonataAdminBundle/assignees{/user}","branches_url":"https://api.github.com/repos/jo66/SonataAdminBundle/branches{/branch}","tags_url":"https://api.github.com/repos/jo66/SonataAdminBundle/tags","blobs_url":"https://api.github.com/repos/jo66/SonataAdminBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jo66/SonataAdminBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jo66/SonataAdminBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/jo66/SonataAdminBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jo66/SonataAdminBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/jo66/SonataAdminBundle/languages","stargazers_url":"https://api.github.com/repos/jo66/SonataAdminBundle/stargazers","contributors_url":"https://api.github.com/repos/jo66/SonataAdminBundle/contributors","subscribers_url":"https://api.github.com/repos/jo66/SonataAdminBundle/subscribers","subscription_url":"https://api.github.com/repos/jo66/SonataAdminBundle/subscription","commits_url":"https://api.github.com/repos/jo66/SonataAdminBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/jo66/SonataAdminBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/jo66/SonataAdminBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/jo66/SonataAdminBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/jo66/SonataAdminBundle/contents/{+path}","compare_url":"https://api.github.com/repos/jo66/SonataAdminBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jo66/SonataAdminBundle/merges","archive_url":"https://api.github.com/repos/jo66/SonataAdminBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jo66/SonataAdminBundle/downloads","issues_url":"https://api.github.com/repos/jo66/SonataAdminBundle/issues{/number}","pulls_url":"https://api.github.com/repos/jo66/SonataAdminBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/jo66/SonataAdminBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/jo66/SonataAdminBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jo66/SonataAdminBundle/labels{/name}","releases_url":"https://api.github.com/repos/jo66/SonataAdminBundle/releases{/id}","deployments_url":"https://api.github.com/repos/jo66/SonataAdminBundle/deployments","created_at":"2018-11-22T16:45:29Z","updated_at":"2018-11-22T16:45:34Z","pushed_at":"2018-11-22T19:04:42Z","git_url":"git://github.com/jo66/SonataAdminBundle.git","ssh_url":"git@github.com:jo66/SonataAdminBundle.git","clone_url":"https://github.com/jo66/SonataAdminBundle.git","svn_url":"https://github.com/jo66/SonataAdminBundle","homepage":"https://sonata-project.org/","size":22163,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"3.x"}},"base":{"label":"sonata-project:3.x","ref":"3.x","sha":"b23a4ca42f061d682d892bb6142ad4bf2699adac","user":{"login":"sonata-project","id":404157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNDE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/404157?v=4","gravatar_id":"","url":"https://api.github.com/users/sonata-project","html_url":"https://github.com/sonata-project","followers_url":"https://api.github.com/users/sonata-project/followers","following_url":"https://api.github.com/users/sonata-project/following{/other_user}","gists_url":"https://api.github.com/users/sonata-project/gists{/gist_id}","starred_url":"https://api.github.com/users/sonata-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonata-project/subscriptions","organizations_url":"https://api.github.com/users/sonata-project/orgs","repos_url":"https://api.github.com/users/sonata-project/repos","events_url":"https://api.github.com/users/sonata-project/events{/privacy}","received_events_url":"https://api.github.com/users/sonata-project/received_events","type":"Organization","site_admin":false},"repo":{"id":1095228,"node_id":"MDEwOlJlcG9zaXRvcnkxMDk1MjI4","name":"SonataAdminBundle","full_name":"sonata-project/SonataAdminBundle","private":false,"owner":{"login":"sonata-project","id":404157,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQwNDE1Nw==","avatar_url":"https://avatars0.githubusercontent.com/u/404157?v=4","gravatar_id":"","url":"https://api.github.com/users/sonata-project","html_url":"https://github.com/sonata-project","followers_url":"https://api.github.com/users/sonata-project/followers","following_url":"https://api.github.com/users/sonata-project/following{/other_user}","gists_url":"https://api.github.com/users/sonata-project/gists{/gist_id}","starred_url":"https://api.github.com/users/sonata-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonata-project/subscriptions","organizations_url":"https://api.github.com/users/sonata-project/orgs","repos_url":"https://api.github.com/users/sonata-project/repos","events_url":"https://api.github.com/users/sonata-project/events{/privacy}","received_events_url":"https://api.github.com/users/sonata-project/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sonata-project/SonataAdminBundle","description":"AdminBundle - The missing Symfony Admin Generator","fork":false,"url":"https://api.github.com/repos/sonata-project/SonataAdminBundle","forks_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/forks","keys_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/teams","hooks_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/hooks","issue_events_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/events{/number}","events_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/events","assignees_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/assignees{/user}","branches_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/branches{/branch}","tags_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/tags","blobs_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/git/refs{/sha}","trees_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/statuses/{sha}","languages_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/languages","stargazers_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/stargazers","contributors_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/contributors","subscribers_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/subscribers","subscription_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/subscription","commits_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/commits{/sha}","git_commits_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/git/commits{/sha}","comments_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/comments{/number}","issue_comment_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/comments{/number}","contents_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/contents/{+path}","compare_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/merges","archive_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/downloads","issues_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues{/number}","pulls_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls{/number}","milestones_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/milestones{/number}","notifications_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/labels{/name}","releases_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/releases{/id}","deployments_url":"https://api.github.com/repos/sonata-project/SonataAdminBundle/deployments","created_at":"2010-11-19T17:08:52Z","updated_at":"2018-11-21T07:38:19Z","pushed_at":"2018-11-23T08:39:19Z","git_url":"git://github.com/sonata-project/SonataAdminBundle.git","ssh_url":"git@github.com:sonata-project/SonataAdminBundle.git","clone_url":"https://github.com/sonata-project/SonataAdminBundle.git","svn_url":"https://github.com/sonata-project/SonataAdminBundle","homepage":"https://sonata-project.org/","size":22130,"stargazers_count":1733,"watchers_count":1733,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1181,"mirror_url":null,"archived":false,"open_issues_count":276,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1181,"open_issues":276,"watchers":1733,"default_branch":"3.x"}},"_links":{"self":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309"},"html":{"href":"https://github.com/sonata-project/SonataAdminBundle/pull/5309"},"issue":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/5309"},"comments":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/issues/5309/comments"},"review_comments":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309/comments"},"review_comment":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/pulls/5309/commits"},"statuses":{"href":"https://api.github.com/repos/sonata-project/SonataAdminBundle/statuses/d03cfa6461efb4858181adcd12d1e39d61b0303a"}},"author_association":"NONE"}}
{"actor":{"display_login":"kunicmarko20"}}