From 1b13d6b906f82659e8d93d24edbbfb551b315a20 Mon Sep 17 00:00:00 2001 From: Johannes Wachter Date: Mon, 23 Sep 2019 14:02:21 +0200 Subject: [PATCH] 04 - Add additional languages to the website --- config/routes_website.yaml | 2 +- config/webspaces/example.xml | 10 ++++++---- templates/base.html.twig | 6 ++++++ .../Controller/Website/EventWebsiteControllerTest.php | 2 +- tests/Functional/Pages/HomepageTest.php | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/config/routes_website.yaml b/config/routes_website.yaml index 7366b42..271ee24 100644 --- a/config/routes_website.yaml +++ b/config/routes_website.yaml @@ -1,5 +1,5 @@ # Define your website routes here app.event: - path: /event/{id} + path: /{_locale}/event/{id} controller: App\Controller\Website\EventWebsiteController::indexAction diff --git a/config/webspaces/example.xml b/config/webspaces/example.xml index 6c48607..a7e4987 100644 --- a/config/webspaces/example.xml +++ b/config/webspaces/example.xml @@ -10,6 +10,8 @@ + + @@ -48,22 +50,22 @@ - {host} + {host}/{localization} - {host} + {host}/{localization} - {host} + {host}/{localization} - {host} + {host}/{localization} diff --git a/templates/base.html.twig b/templates/base.html.twig index d42fec6..10b987a 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -41,6 +41,12 @@ {% endfor %} + + diff --git a/tests/Functional/Controller/Website/EventWebsiteControllerTest.php b/tests/Functional/Controller/Website/EventWebsiteControllerTest.php index 140daa5..3cfcb1b 100644 --- a/tests/Functional/Controller/Website/EventWebsiteControllerTest.php +++ b/tests/Functional/Controller/Website/EventWebsiteControllerTest.php @@ -29,7 +29,7 @@ public function testIndexAction(): void { $event = $this->createEvent('Sulu is awesome', 'en'); - $crawler = $this->client->request('GET', '/event/' . $event->getId()); + $crawler = $this->client->request('GET', '/en/event/' . $event->getId()); $response = $this->client->getResponse(); $this->assertInstanceOf(Response::class, $response); diff --git a/tests/Functional/Pages/HomepageTest.php b/tests/Functional/Pages/HomepageTest.php index 27bd589..09838bf 100644 --- a/tests/Functional/Pages/HomepageTest.php +++ b/tests/Functional/Pages/HomepageTest.php @@ -50,7 +50,7 @@ public function testHomepage(): void ] ); - $crawler = $this->client->request(Request::METHOD_GET, '/homepage'); + $crawler = $this->client->request(Request::METHOD_GET, '/en/homepage'); $response = $this->client->getResponse(); $this->assertInstanceOf(Response::class, $response);