From b110223ee64eb3ca2dd96a1abbec3024eb484889 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Feb 2023 12:41:54 +0100 Subject: [PATCH] i18n: Rename translations keys --- .../Organizations/TicketsController.php | 4 +- src/Controller/ProfileController.php | 2 +- src/Controller/Tickets/ActorsController.php | 4 +- src/Entity/Ticket.php | 22 +- src/Repository/RoleRepository.php | 6 +- templates/_modal_dialog.html.twig | 4 +- templates/_sidebar_settings.html.twig | 8 +- templates/alerts/_error.html.twig | 2 +- templates/base.html.twig | 22 +- templates/login/new.html.twig | 16 +- templates/organizations/index.html.twig | 12 +- templates/organizations/new.html.twig | 18 +- .../organizations/tickets/index.html.twig | 44 ++- templates/organizations/tickets/new.html.twig | 36 +-- templates/pages/about.html.twig | 16 +- templates/pages/home.html.twig | 22 +- templates/pages/webmanifest.json.twig | 2 +- templates/preferences/edit.html.twig | 20 +- templates/profile/edit.html.twig | 32 +-- templates/roles/_role_form.html.twig | 38 +-- templates/roles/edit.html.twig | 6 +- templates/roles/index.html.twig | 12 +- templates/roles/new.html.twig | 6 +- templates/settings/index.html.twig | 10 +- templates/tickets/actors/edit.html.twig | 20 +- templates/tickets/priority/edit.html.twig | 16 +- templates/tickets/show.html.twig | 68 ++--- templates/tickets/title/edit.html.twig | 10 +- templates/users/index.html.twig | 4 +- translations/messages+intl-icu.en_GB.yaml | 263 +++++++++--------- translations/messages+intl-icu.fr_FR.yaml | 263 +++++++++--------- translations/validators+intl-icu.en_GB.yaml | 3 + translations/validators+intl-icu.fr_FR.yaml | 3 + 33 files changed, 497 insertions(+), 517 deletions(-) diff --git a/src/Controller/Organizations/TicketsController.php b/src/Controller/Organizations/TicketsController.php index 423b437a..0ba10e69 100644 --- a/src/Controller/Organizations/TicketsController.php +++ b/src/Controller/Organizations/TicketsController.php @@ -164,7 +164,7 @@ public function create( 'statuses' => Ticket::getStatusesWithLabels(), 'users' => $users, 'errors' => [ - 'requester' => new TranslatableMessage('The requester must exist.'), + 'requester' => new TranslatableMessage('The requester must exist.', [], 'validators'), ], ]); } @@ -182,7 +182,7 @@ public function create( 'statuses' => Ticket::getStatusesWithLabels(), 'users' => $users, 'errors' => [ - 'assignee' => new TranslatableMessage('The assignee must exist.'), + 'assignee' => new TranslatableMessage('The assignee must exist.', [], 'validators'), ], ]); } diff --git a/src/Controller/ProfileController.php b/src/Controller/ProfileController.php index 9a2a9f04..487e5c58 100644 --- a/src/Controller/ProfileController.php +++ b/src/Controller/ProfileController.php @@ -71,7 +71,7 @@ public function update( 'name' => $name, 'email' => $email, 'errors' => [ - 'password' => new TranslatableMessage('The password is invalid.'), + 'password' => new TranslatableMessage('The password is invalid.', [], 'validators'), ], ]); } diff --git a/src/Controller/Tickets/ActorsController.php b/src/Controller/Tickets/ActorsController.php index fbebca29..a8b2d37a 100644 --- a/src/Controller/Tickets/ActorsController.php +++ b/src/Controller/Tickets/ActorsController.php @@ -80,7 +80,7 @@ public function update( 'assigneeId' => $assigneeId, 'users' => $users, 'errors' => [ - 'requester' => new TranslatableMessage('The requester must exist.'), + 'requester' => new TranslatableMessage('The requester must exist.', [], 'validators'), ], ]); } @@ -94,7 +94,7 @@ public function update( 'assigneeId' => $assigneeId, 'users' => $users, 'errors' => [ - 'assignee' => new TranslatableMessage('The assignee must exist.'), + 'assignee' => new TranslatableMessage('The assignee must exist.', [], 'validators'), ], ]); } diff --git a/src/Entity/Ticket.php b/src/Entity/Ticket.php index 566d42c3..2b652f65 100644 --- a/src/Entity/Ticket.php +++ b/src/Entity/Ticket.php @@ -351,12 +351,12 @@ public function setOrganization(?Organization $organization): self public static function getStatusesWithLabels(): array { return [ - 'new' => new TranslatableMessage('New'), - 'in_progress' => new TranslatableMessage('In progress'), - 'planned' => new TranslatableMessage('Planned'), - 'pending' => new TranslatableMessage('Pending'), - 'resolved' => new TranslatableMessage('Resolved'), - 'closed' => new TranslatableMessage('Closed'), + 'new' => new TranslatableMessage('tickets.status.new'), + 'in_progress' => new TranslatableMessage('tickets.status.in_progress'), + 'planned' => new TranslatableMessage('tickets.status.planned'), + 'pending' => new TranslatableMessage('tickets.status.pending'), + 'resolved' => new TranslatableMessage('tickets.status.resolved'), + 'closed' => new TranslatableMessage('tickets.status.closed'), ]; } @@ -366,8 +366,8 @@ public static function getStatusesWithLabels(): array public static function getTypesWithLabels(): array { return [ - 'request' => new TranslatableMessage('Request'), - 'incident' => new TranslatableMessage('Incident'), + 'request' => new TranslatableMessage('tickets.request'), + 'incident' => new TranslatableMessage('tickets.incident'), ]; } @@ -377,9 +377,9 @@ public static function getTypesWithLabels(): array public static function getWeightsWithLabels(): array { return [ - 'low' => new TranslatableMessage('Low'), - 'medium' => new TranslatableMessage('Medium'), - 'high' => new TranslatableMessage('High'), + 'low' => new TranslatableMessage('tickets.weight.low'), + 'medium' => new TranslatableMessage('tickets.weight.medium'), + 'high' => new TranslatableMessage('tickets.weight.high'), ]; } diff --git a/src/Repository/RoleRepository.php b/src/Repository/RoleRepository.php index c56cbc04..a41f1c21 100644 --- a/src/Repository/RoleRepository.php +++ b/src/Repository/RoleRepository.php @@ -57,10 +57,8 @@ public function findOrCreateSuperRole(): Role $superRole = new Role(); $superRole->setUid($this->generateUid()); $superRole->setCreatedAt(Time::now()); - $superRole->setName(new TranslatableMessage('Super-admin')); - $superRole->setDescription( - new TranslatableMessage('A special admin role with an access to everything (cannot be deleted).') - ); + $superRole->setName(new TranslatableMessage('roles.super_admin')); + $superRole->setDescription(new TranslatableMessage('roles.super_admin.description')); $superRole->setType('super'); $superRole->setPermissions(['admin:*']); diff --git a/templates/_modal_dialog.html.twig b/templates/_modal_dialog.html.twig index ce5a940f..1467419b 100644 --- a/templates/_modal_dialog.html.twig +++ b/templates/_modal_dialog.html.twig @@ -25,11 +25,11 @@ type="button" class="button--icon" data-action="modal#close" - title="{{ 'Close this window' | trans }}" + title="{{ 'layout.modal.close' | trans }}" > {{ icon('close') }} - {{ 'Close' | trans }} + {{ 'layout.modal.close' | trans }} diff --git a/templates/_sidebar_settings.html.twig b/templates/_sidebar_settings.html.twig index 6b736b44..231d462c 100644 --- a/templates/_sidebar_settings.html.twig +++ b/templates/_sidebar_settings.html.twig @@ -6,7 +6,7 @@ diff --git a/templates/login/new.html.twig b/templates/login/new.html.twig index 86ffaae9..5881a85b 100644 --- a/templates/login/new.html.twig +++ b/templates/login/new.html.twig @@ -6,7 +6,7 @@ {% extends 'base.html.twig' %} -{% block title %}{{ 'Log in' | trans }}{% endblock %} +{% block title %}{{ 'login.title' | trans }}{% endblock %} {% block layout_header %}