From dab99ad23f0958d2c9470ce0b73ab51b7389047c Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Wed, 21 Nov 2018 18:56:50 -0300 Subject: [PATCH] Use "HackzillaTicketBundle" as translation domain instead of "messages" --- Command/AutoClosingCommand.php | 2 +- Controller/TicketAttachmentController.php | 2 +- Controller/TicketController.php | 6 +-- Manager/TicketManager.php | 4 +- Resources/views/Macros/macros.html.twig | 18 ++++----- Resources/views/Ticket/index.html.twig | 48 +++++++++++------------ Resources/views/Ticket/new.html.twig | 6 +-- Resources/views/Ticket/show.html.twig | 30 +++++++------- 8 files changed, 58 insertions(+), 58 deletions(-) diff --git a/Command/AutoClosingCommand.php b/Command/AutoClosingCommand.php index 170dcddd..b0e1236b 100644 --- a/Command/AutoClosingCommand.php +++ b/Command/AutoClosingCommand.php @@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($resolved_tickets as $ticket) { $message = $ticket_manager->createMessage() ->setMessage( - $translator->trans('MESSAGE_STATUS_CHANGED', ['%status%' => $translator->trans('STATUS_CLOSED')]) + $translator->trans('MESSAGE_STATUS_CHANGED', ['%status%' => $translator->trans('STATUS_CLOSED', [], 'HackzillaTicketBundle')], 'HackzillaTicketBundle') ) ->setStatus(TicketMessage::STATUS_CLOSED) ->setPriority($ticket->getPriority()) diff --git a/Controller/TicketAttachmentController.php b/Controller/TicketAttachmentController.php index e0716c9d..c8945ad2 100644 --- a/Controller/TicketAttachmentController.php +++ b/Controller/TicketAttachmentController.php @@ -25,7 +25,7 @@ public function downloadAction($ticketMessageId) $ticketMessage = $ticketManager->getMessageById($ticketMessageId); if (!$ticketMessage || !$ticketMessage instanceof TicketMessageWithAttachment) { - throw $this->createNotFoundException($this->get('translator')->trans('ERROR_FIND_TICKET_ENTITY')); + throw $this->createNotFoundException($this->get('translator')->trans('ERROR_FIND_TICKET_ENTITY', [], 'HackzillaTicketBundle')); } // check permissions diff --git a/Controller/TicketController.php b/Controller/TicketController.php index 1df4ea66..fdfab7cd 100644 --- a/Controller/TicketController.php +++ b/Controller/TicketController.php @@ -30,7 +30,7 @@ public function indexAction(Request $request) $userManager = $this->getUserManager(); $ticketManager = $this->get('hackzilla_ticket.ticket_manager'); - $ticketState = $request->get('state', $this->get('translator')->trans('STATUS_OPEN')); + $ticketState = $request->get('state', $this->get('translator')->trans('STATUS_OPEN', [], 'HackzillaTicketBundle')); $ticketPriority = $request->get('priority', null); $query = $ticketManager->getTicketList( @@ -157,7 +157,7 @@ public function replyAction(Request $request, $ticketId) $ticket = $ticketManager->getTicketById($ticketId); if (!$ticket) { - throw $this->createNotFoundException($this->get('translator')->trans('ERROR_FIND_TICKET_ENTITY')); + throw $this->createNotFoundException($this->get('translator')->trans('ERROR_FIND_TICKET_ENTITY', [], 'HackzillaTicketBundle')); } $user = $this->getUserManager()->getCurrentUser(); @@ -212,7 +212,7 @@ public function deleteAction(Request $request, $ticketId) $ticket = $ticketManager->getTicketById($ticketId); if (!$ticket) { - throw $this->createNotFoundException($this->get('translator')->trans('ERROR_FIND_TICKET_ENTITY')); + throw $this->createNotFoundException($this->get('translator')->trans('ERROR_FIND_TICKET_ENTITY', [], 'HackzillaTicketBundle')); } $ticketManager->deleteTicket($ticket); diff --git a/Manager/TicketManager.php b/Manager/TicketManager.php index 54c54126..8d6ec352 100644 --- a/Manager/TicketManager.php +++ b/Manager/TicketManager.php @@ -266,7 +266,7 @@ public function getTicketStatus($statusStr) $statuses = []; foreach (TicketMessageInterface::STATUSES as $id => $value) { - $statuses[$id] = $this->translator->trans($value); + $statuses[$id] = $this->translator->trans($value, [], 'HackzillaTicketBundle'); } } @@ -288,7 +288,7 @@ public function getTicketPriority($priorityStr) $priorities = []; foreach (TicketMessageInterface::PRIORITIES as $id => $value) { - $priorities[$id] = $this->translator->trans($value); + $priorities[$id] = $this->translator->trans($value, [], 'HackzillaTicketBundle'); } } diff --git a/Resources/views/Macros/macros.html.twig b/Resources/views/Macros/macros.html.twig index 84cce4d5..0a9629de 100644 --- a/Resources/views/Macros/macros.html.twig +++ b/Resources/views/Macros/macros.html.twig @@ -25,25 +25,25 @@ {% macro status_alert(status, text) %} {% spaceless %} {% if status == 10 %} - @@ -39,13 +39,13 @@ - - {{ knp_pagination_sortable(pagination, 'HEADING_SUBJECT'|trans, 't.subject') }} - {{ knp_pagination_sortable(pagination, 'HEADING_AUTHOR'|trans, 't.userCreated') }} - {{ knp_pagination_sortable(pagination, 'HEADING_STATUS'|trans, 't.status') }} - {{ knp_pagination_sortable(pagination, 'HEADING_PRIORITY'|trans, 't.priority') }} - {{ knp_pagination_sortable(pagination, 'HEADING_MODIFIED'|trans, 't.lastMessage') }} - {{ knp_pagination_sortable(pagination, 'HEADING_CREATED'|trans, 't.createdAt') }} + + {{ knp_pagination_sortable(pagination, 'HEADING_SUBJECT'|trans({}, 'HackzillaTicketBundle'), 't.subject') }} + {{ knp_pagination_sortable(pagination, 'HEADING_AUTHOR'|trans({}, 'HackzillaTicketBundle'), 't.userCreated') }} + {{ knp_pagination_sortable(pagination, 'HEADING_STATUS'|trans({}, 'HackzillaTicketBundle'), 't.status') }} + {{ knp_pagination_sortable(pagination, 'HEADING_PRIORITY'|trans({}, 'HackzillaTicketBundle'), 't.priority') }} + {{ knp_pagination_sortable(pagination, 'HEADING_MODIFIED'|trans({}, 'HackzillaTicketBundle'), 't.lastMessage') }} + {{ knp_pagination_sortable(pagination, 'HEADING_CREATED'|trans({}, 'HackzillaTicketBundle'), 't.createdAt') }} @@ -54,14 +54,14 @@ - - - - + + + + {% else %} - + {% endfor %} diff --git a/Resources/views/Ticket/new.html.twig b/Resources/views/Ticket/new.html.twig index 2b9c189f..9a8d6e48 100644 --- a/Resources/views/Ticket/new.html.twig +++ b/Resources/views/Ticket/new.html.twig @@ -1,7 +1,7 @@ {% extends 'HackzillaTicketBundle::layout.html.twig' %} {% block hackzilla_ticket_content -%} -

{{ 'HEADING_NEW_TICKET'|trans }}

+

{{ 'HEADING_NEW_TICKET'|trans({}, 'HackzillaTicketBundle') }}

{{ form_start(form, {'method': 'POST', 'action': path('hackzilla_ticket_create')}) }} @@ -23,10 +23,10 @@
- + - {{ 'BUTTON_BACK_TO_LIST'|trans }} + {{ 'BUTTON_BACK_TO_LIST'|trans({}, 'HackzillaTicketBundle') }}
diff --git a/Resources/views/Ticket/show.html.twig b/Resources/views/Ticket/show.html.twig index 89a8f940..404891f3 100644 --- a/Resources/views/Ticket/show.html.twig +++ b/Resources/views/Ticket/show.html.twig @@ -4,48 +4,48 @@ {% block hackzilla_ticket_content -%}

- {{ 'BUTTON_BACK_TO_LIST'|trans }} + {{ 'BUTTON_BACK_TO_LIST'|trans({}, 'HackzillaTicketBundle') }}

- {{ macros.status_btn(ticket.status, ticket.statusString|trans) }} - {{ macros.priority_btn(ticket.priority, ticket.priorityString|trans) }} + {{ macros.status_btn(ticket.status, ticket.statusString|trans({}, 'HackzillaTicketBundle')) }} + {{ macros.priority_btn(ticket.priority, ticket.priorityString|trans({}, 'HackzillaTicketBundle')) }} #{{ ticket.id }} - {{ ticket.subject }}

- {{ 'LABEL_CREATED_BY'|trans }} {{ ticket.userCreatedObject }} - , {{ ticket.createdAt|date('LABEL_DATE_FORMAT'|trans) }} - {#
{{ 'LABEL_PRIORITY'|trans }} {{ ticket.priorityString|trans }} #} + {{ 'LABEL_CREATED_BY'|trans({}, 'HackzillaTicketBundle') }} {{ ticket.userCreatedObject }} + , {{ ticket.createdAt|date('LABEL_DATE_FORMAT'|trans({}, 'HackzillaTicketBundle')) }} + {#
{{ 'LABEL_PRIORITY'|trans({}, 'HackzillaTicketBundle') }} {{ ticket.priorityString|trans({}, 'HackzillaTicketBundle') }} #}

- {#

{{ 'HEADING_TICKET_THREAD'|trans }}

#} + {#

{{ 'HEADING_TICKET_THREAD'|trans({}, 'HackzillaTicketBundle') }}

#} {% set previousStatus = null %} {% set previousPriority = null %} {% for message in ticket.messages %} {% if previousStatus and previousStatus != message.status %} - {{ macros.status_alert(message.status, message.statusString|trans) }} + {{ macros.status_alert(message.status, message.statusString|trans({}, 'HackzillaTicketBundle')) }} {% endif %} {% if previousPriority and previousPriority != message.priority %} - {{ macros.priority_alert(message.priority, message.priorityString|trans) }} + {{ macros.priority_alert(message.priority, message.priorityString|trans({}, 'HackzillaTicketBundle')) }} {% endif %} {% if message.message|length > 0 %}
{{ message.userObject }} - {#
{{ 'LABEL_PRIORITY'|trans }} {{ message.priorityString|trans }} #} - {#
{{ 'LABEL_STATUS'|trans }} {{ message.statusString|trans }} #} + {#
{{ 'LABEL_PRIORITY'|trans({}, 'HackzillaTicketBundle') }} {{ message.priorityString|trans({}, 'HackzillaTicketBundle') }} #} + {#
{{ 'LABEL_STATUS'|trans({}, 'HackzillaTicketBundle') }} {{ message.statusString|trans({}, 'HackzillaTicketBundle') }} #} {% if message.userObject != ticket.userCreatedObject %}{{ 'LABEL_ADMIN'|trans }} {% endif %} - {{ message.createdAt|date('LABEL_DATE_TIME_FORMAT'|trans) }} + class="label label-danger">{{ 'LABEL_ADMIN'|trans({}, 'HackzillaTicketBundle') }} {% endif %} + {{ message.createdAt|date('LABEL_DATE_TIME_FORMAT'|trans({}, 'HackzillaTicketBundle')) }}
@@ -71,7 +71,7 @@ {{ form_rest(form) }}

- +

{{ form_end(form) }}
@@ -82,7 +82,7 @@ {{ form_widget(delete_form) }} - + {{ form_end(delete_form) }} {% endif %}
{{ knp_pagination_sortable(pagination, 'HEADING_TICKET'|trans, 't.id') }}{{ knp_pagination_sortable(pagination, 'HEADING_TICKET'|trans({}, 'HackzillaTicketBundle'), 't.id') }}
{{ entity.id }} {{ entity.subject }} {{ entity.userCreatedObject }}{{ macros.status_btn(entity.status, entity.statusString|trans, true) }}{{ macros.priority_btn(entity.priority, entity.priorityString|trans, true) }}{% if entity.lastMessage %}{{ entity.lastMessage|date('LABEL_DATE_TIME_FORMAT'|trans) }}{% endif %}{% if entity.createdAt %}{{ entity.createdAt|date('LABEL_DATE_TIME_FORMAT'|trans) }}{% endif %}{{ macros.status_btn(entity.status, entity.statusString|trans({}, 'HackzillaTicketBundle'), true) }}{{ macros.priority_btn(entity.priority, entity.priorityString|trans({}, 'HackzillaTicketBundle'), true) }}{% if entity.lastMessage %}{{ entity.lastMessage|date('LABEL_DATE_TIME_FORMAT'|trans({}, 'HackzillaTicketBundle')) }}{% endif %}{% if entity.createdAt %}{{ entity.createdAt|date('LABEL_DATE_TIME_FORMAT'|trans({}, 'HackzillaTicketBundle')) }}{% endif %}
{{ 'MESSAGE_NO_TICKETS'|trans }}.{{ 'MESSAGE_NO_TICKETS'|trans({}, 'HackzillaTicketBundle') }}.