From 885d5321c8b7bbf5c1704f73422b5265bffd9e11 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/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 e9df8c4..5b60791 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\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 88c8edc..3f93571 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -41,6 +41,12 @@ {% endfor %} + + diff --git a/tests/Functional/Controller/EventWebsiteControllerTest.php b/tests/Functional/Controller/EventWebsiteControllerTest.php index 3e24ea1..49b0a79 100644 --- a/tests/Functional/Controller/EventWebsiteControllerTest.php +++ b/tests/Functional/Controller/EventWebsiteControllerTest.php @@ -26,7 +26,7 @@ public function testIndexAction(): void $event = $this->createEvent('Sulu is awesome', 'en'); - $crawler = $client->request('GET', '/event/' . $event->getId()); + $crawler = $client->request('GET', '/en/event/' . $event->getId()); $response = $client->getResponse(); $this->assertInstanceOf(Response::class, $response); diff --git a/tests/Functional/Pages/HomepageTest.php b/tests/Functional/Pages/HomepageTest.php index 74bc3ce..c0c0ac1 100644 --- a/tests/Functional/Pages/HomepageTest.php +++ b/tests/Functional/Pages/HomepageTest.php @@ -45,7 +45,7 @@ public function testHomepage(): void ); $client = $this->createWebsiteClient(); - $crawler = $client->request(Request::METHOD_GET, '/homepage'); + $crawler = $client->request(Request::METHOD_GET, '/en/homepage'); $response = $client->getResponse(); $this->assertInstanceOf(Response::class, $response);