From 22eace022c145c9cd43011cddc54841567983dc6 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 21 Aug 2019 17:49:04 +0200 Subject: [PATCH] Add more words to translate --- config/packages/security.yaml | 4 ++-- src/Controller/FediPlanController.php | 17 ++++++++--------- templates/nav.html.twig | 8 ++++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/config/packages/security.yaml b/config/packages/security.yaml index b026779..1e71116 100644 --- a/config/packages/security.yaml +++ b/config/packages/security.yaml @@ -21,5 +21,5 @@ security: # Note: Only the *first* access control that matches will be used access_control: # - { path: ^/admin, roles: ROLE_ADMIN } - - { path: ^/schedule, roles: ROLE_USER } - - { path: ^/scheduled, roles: ROLE_USER } + - { path: ^/(en|fr)?/schedule, roles: ROLE_USER } + - { path: ^/(en|fr)?/scheduled, roles: ROLE_USER } diff --git a/src/Controller/FediPlanController.php b/src/Controller/FediPlanController.php index 633fe88..33c662d 100644 --- a/src/Controller/FediPlanController.php +++ b/src/Controller/FediPlanController.php @@ -27,15 +27,13 @@ use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; -/** - * @Route("/{_locale}", defaults={"_locale":"en"}, requirements={"_locale": "en|fr"}) - */ + class FediPlanController extends AbstractController { /** - * @Route(name="index") + * @Route("/{_locale}",name="index", defaults={"_locale"="en"}, requirements={"_locale": "en|fr"}) */ public function indexAction(Request $request, AuthorizationCheckerInterface $authorizationChecker, ConnectMastodonAccountFlow $flow, Mastodon_api $mastodon_api, TranslatorInterface $translator, EventDispatcherInterface $eventDispatcher) { @@ -148,7 +146,7 @@ class FediPlanController extends AbstractController /** - * @Route("/schedule", name="schedule") + * @Route("/{_locale}/schedule", name="schedule", defaults={"_locale"="en"}, requirements={"_locale": "en|fr"}) */ public function schedule(Request $request, Mastodon_api $mastodon_api) { @@ -236,7 +234,7 @@ class FediPlanController extends AbstractController /** - * @Route("/scheduled", name="scheduled") + * @Route("/{_locale}/scheduled", name="scheduled", defaults={"_locale"="en"}, requirements={"_locale": "en|fr"}) */ public function scheduled() { @@ -245,7 +243,7 @@ class FediPlanController extends AbstractController /** - * @Route("/scheduled/messages/{max_id}", options={"expose"=true}, name="load_more") + * @Route("/{_locale}/scheduled/messages/{max_id}", options={"expose"=true}, name="load_more") */ public function loadMoreAction(Mastodon_api $mastodon_api, String $max_id = null){ @@ -275,7 +273,7 @@ class FediPlanController extends AbstractController } /** - * @Route("/scheduled/delete/messages/{id}", options={"expose"=true}, name="delete_message", methods={"POST"}) + * @Route("/{_locale}/scheduled/delete/messages/{id}", options={"expose"=true}, name="delete_message", methods={"POST"}, defaults={"_locale"="en"}, requirements={"_locale": "en|fr"}) */ public function deleteMessage(Mastodon_api $mastodon_api, String $id = null){ @@ -294,7 +292,8 @@ class FediPlanController extends AbstractController } /** - * @Route("/about", name="about") + * @Route("/about",defaults={"_locale"="en"}) + * @Route("/{_locale}/about", name="about", defaults={"_locale":"en"}, requirements={"_locale": "en|fr"}) */ public function about() { diff --git a/templates/nav.html.twig b/templates/nav.html.twig index 88b3ba2..18d0002 100644 --- a/templates/nav.html.twig +++ b/templates/nav.html.twig @@ -38,8 +38,12 @@ language