Skip to content

Commit

Permalink
Use "HackzillaTicketBundle" as translation domain instead of "messages"
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Nov 21, 2018
1 parent 4036cf1 commit dab99ad
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Command/AutoClosingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion Controller/TicketAttachmentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Controller/TicketController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Manager/TicketManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand All @@ -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');
}
}

Expand Down
18 changes: 9 additions & 9 deletions Resources/views/Macros/macros.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@
{% macro status_alert(status, text) %}
{% spaceless %}
{% if status == 10 %}
<div class="alert alert-warning" role="alert"><span class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }) }}
<div class="alert alert-warning" role="alert"><span class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% elseif status == 11 %}
<div class="alert alert-info" role="alert"><span
class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }) }}
class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% elseif status == 12 %}
<div class="alert alert-info" role="alert"><span
class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }) }}
class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% elseif status == 13 %}
<div class="alert alert-info" role="alert"><span
class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }) }}
class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% elseif status == 14 %}
<div class="alert alert-success" role="alert"><span class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }) }}
<div class="alert alert-success" role="alert"><span class="glyphicon glyphicon-folder-open"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% elseif status == 15 %}
<div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-folder-close"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }) }}
<div class="alert alert-danger" role="alert"><span class="glyphicon glyphicon-folder-close"></span>&nbsp;&nbsp;{{ 'MESSAGE_STATUS_CHANGED'|trans({'%status%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% endif %}
{% endspaceless %}
Expand All @@ -67,14 +67,14 @@
{% spaceless %}
{% if priority <= 20 %}
<div class="alert alert-info"
role="alert">{{ 'MESSAGE_PRIORITY_CHANGED'|trans({'%priority%': text|upper }) }}</div>
role="alert">{{ 'MESSAGE_PRIORITY_CHANGED'|trans({'%priority%': text|upper }, 'HackzillaTicketBundle') }}</div>
{% elseif priority == 21 %}
<div class="alert alert-warning" role="alert"><span
class="glyphicon glyphicon-asterisk"></span>&nbsp;&nbsp;{{ 'MESSAGE_PRIORITY_CHANGED'|trans({'%priority%': text|upper }) }}
class="glyphicon glyphicon-asterisk"></span>&nbsp;&nbsp;{{ 'MESSAGE_PRIORITY_CHANGED'|trans({'%priority%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% else %}
<div class="alert alert-danger" role="alert"><span
class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;{{ 'MESSAGE_PRIORITY_CHANGED'|trans({'%priority%': text|upper }) }}
class="glyphicon glyphicon-star"></span>&nbsp;&nbsp;{{ 'MESSAGE_PRIORITY_CHANGED'|trans({'%priority%': text|upper }, 'HackzillaTicketBundle') }}
</div>
{% endif %}
{% endspaceless %}
Expand Down
48 changes: 24 additions & 24 deletions Resources/views/Ticket/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{% import hackzilla_ticket.templates.macros as macros %}

{% block hackzilla_ticket_content -%}
<h1>{{ 'HEADING_TICKET_LIST'|trans }}</h1>
<h1>{{ 'HEADING_TICKET_LIST'|trans({}, 'HackzillaTicketBundle') }}</h1>

<div class="row">
<div class="col-xs-4">
<div class="btn-group">
<a href="{{ path('hackzilla_ticket', {'state': 'STATUS_OPEN'|trans}) }}"
class="btn btn-default {{ ticketState != 'STATUS_CLOSED'|trans ? 'active' : '' }}">{{ 'STATUS_OPEN'|trans|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'state': 'STATUS_CLOSED'|trans}) }}"
class="btn btn-default {{ ticketState == 'STATUS_CLOSED'|trans ? 'active' : '' }}">{{ 'STATUS_CLOSED'|trans|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'state': 'STATUS_OPEN'|trans({}, 'HackzillaTicketBundle')}) }}"
class="btn btn-default {{ ticketState != 'STATUS_CLOSED'|trans({}, 'HackzillaTicketBundle') ? 'active' : '' }}">{{ 'STATUS_OPEN'|trans({}, 'HackzillaTicketBundle')|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'state': 'STATUS_CLOSED'|trans({}, 'HackzillaTicketBundle')}) }}"
class="btn btn-default {{ ticketState == 'STATUS_CLOSED'|trans({}, 'HackzillaTicketBundle') ? 'active' : '' }}">{{ 'STATUS_CLOSED'|trans({}, 'HackzillaTicketBundle')|upper }}</a>
</div>
</div>

Expand All @@ -19,33 +19,33 @@
<a href="{{ path('hackzilla_ticket') }}"
class="btn btn-default {{ ticketPriority is null ? 'active' : '' }}"><span
class="glyphicon glyphicon-remove"></span></a>
<a href="{{ path('hackzilla_ticket', {'priority': 'PRIORITY_HIGH'|trans}) }}"
class="btn btn-danger {{ ticketPriority == 'PRIORITY_HIGH'|trans ? 'active' : '' }}">{{ 'PRIORITY_HIGH'|trans|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'priority': 'PRIORITY_MEDIUM'|trans}) }}"
class="btn btn-warning {{ ticketPriority == 'PRIORITY_MEDIUM'|trans ? 'active' : '' }}">{{ 'PRIORITY_MEDIUM'|trans|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'priority': 'PRIORITY_LOW'|trans}) }}"
class="btn btn-info {{ ticketPriority == 'PRIORITY_LOW'|trans ? 'active' : '' }}">{{ 'PRIORITY_LOW'|trans|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'priority': 'PRIORITY_HIGH'|trans({}, 'HackzillaTicketBundle')}) }}"
class="btn btn-danger {{ ticketPriority == 'PRIORITY_HIGH'|trans({}, 'HackzillaTicketBundle') ? 'active' : '' }}">{{ 'PRIORITY_HIGH'|trans({}, 'HackzillaTicketBundle')|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'priority': 'PRIORITY_MEDIUM'|trans({}, 'HackzillaTicketBundle')}) }}"
class="btn btn-warning {{ ticketPriority == 'PRIORITY_MEDIUM'|trans({}, 'HackzillaTicketBundle') ? 'active' : '' }}">{{ 'PRIORITY_MEDIUM'|trans({}, 'HackzillaTicketBundle')|upper }}</a>
<a href="{{ path('hackzilla_ticket', {'priority': 'PRIORITY_LOW'|trans({}, 'HackzillaTicketBundle')}) }}"
class="btn btn-info {{ ticketPriority == 'PRIORITY_LOW'|trans({}, 'HackzillaTicketBundle') ? 'active' : '' }}">{{ 'PRIORITY_LOW'|trans({}, 'HackzillaTicketBundle')|upper }}</a>
</div>
</div>

<div class="col-xs-4 text-right">
<div class="btn-group">
<a href="{{ path('hackzilla_ticket_new') }}" class="btn btn-primary"><span
class="glyphicon glyphicon-plus"></span> {{ 'BUTTON_NEW'|trans }}</a>
class="glyphicon glyphicon-plus"></span> {{ 'BUTTON_NEW'|trans({}, 'HackzillaTicketBundle') }}</a>
</div>
</div>
</div>

<table class="table table-bordered table-striped">
<thead>
<tr>
<th class="col-xs-1">{{ knp_pagination_sortable(pagination, 'HEADING_TICKET'|trans, 't.id') }}</th>
<th{% if pagination.isSorted('t.subject') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_SUBJECT'|trans, 't.subject') }}</th>
<th{% if pagination.isSorted('t.userCreated') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_AUTHOR'|trans, 't.userCreated') }}</th>
<th{% if pagination.isSorted('t.status') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_STATUS'|trans, 't.status') }}</th>
<th{% if pagination.isSorted('t.priority') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_PRIORITY'|trans, 't.priority') }}</th>
<th{% if pagination.isSorted('t.modified') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_MODIFIED'|trans, 't.lastMessage') }}</th>
<th{% if pagination.isSorted('t.created') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_CREATED'|trans, 't.createdAt') }}</th>
<th class="col-xs-1">{{ knp_pagination_sortable(pagination, 'HEADING_TICKET'|trans({}, 'HackzillaTicketBundle'), 't.id') }}</th>
<th{% if pagination.isSorted('t.subject') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_SUBJECT'|trans({}, 'HackzillaTicketBundle'), 't.subject') }}</th>
<th{% if pagination.isSorted('t.userCreated') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_AUTHOR'|trans({}, 'HackzillaTicketBundle'), 't.userCreated') }}</th>
<th{% if pagination.isSorted('t.status') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_STATUS'|trans({}, 'HackzillaTicketBundle'), 't.status') }}</th>
<th{% if pagination.isSorted('t.priority') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_PRIORITY'|trans({}, 'HackzillaTicketBundle'), 't.priority') }}</th>
<th{% if pagination.isSorted('t.modified') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_MODIFIED'|trans({}, 'HackzillaTicketBundle'), 't.lastMessage') }}</th>
<th{% if pagination.isSorted('t.created') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'HEADING_CREATED'|trans({}, 'HackzillaTicketBundle'), 't.createdAt') }}</th>
</tr>
</thead>
<tbody>
Expand All @@ -54,14 +54,14 @@
<td><a href="{{ path('hackzilla_ticket_show', { 'ticketId': entity.id }) }}">{{ entity.id }}</a></td>
<td><a href="{{ path('hackzilla_ticket_show', { 'ticketId': entity.id }) }}">{{ entity.subject }}</a></td>
<td>{{ entity.userCreatedObject }}</td>
<td>{{ macros.status_btn(entity.status, entity.statusString|trans, true) }}</td>
<td>{{ macros.priority_btn(entity.priority, entity.priorityString|trans, true) }}</td>
<td>{% if entity.lastMessage %}{{ entity.lastMessage|date('LABEL_DATE_TIME_FORMAT'|trans) }}{% endif %}</td>
<td>{% if entity.createdAt %}{{ entity.createdAt|date('LABEL_DATE_TIME_FORMAT'|trans) }}{% endif %}</td>
<td>{{ macros.status_btn(entity.status, entity.statusString|trans({}, 'HackzillaTicketBundle'), true) }}</td>
<td>{{ macros.priority_btn(entity.priority, entity.priorityString|trans({}, 'HackzillaTicketBundle'), true) }}</td>
<td>{% if entity.lastMessage %}{{ entity.lastMessage|date('LABEL_DATE_TIME_FORMAT'|trans({}, 'HackzillaTicketBundle')) }}{% endif %}</td>
<td>{% if entity.createdAt %}{{ entity.createdAt|date('LABEL_DATE_TIME_FORMAT'|trans({}, 'HackzillaTicketBundle')) }}{% endif %}</td>
</tr>
{% else %}
<tr>
<td colspan="7">{{ 'MESSAGE_NO_TICKETS'|trans }}.</td>
<td colspan="7">{{ 'MESSAGE_NO_TICKETS'|trans({}, 'HackzillaTicketBundle') }}.</td>
</tr>
{% endfor %}
</tbody>
Expand Down
6 changes: 3 additions & 3 deletions Resources/views/Ticket/new.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'HackzillaTicketBundle::layout.html.twig' %}

{% block hackzilla_ticket_content -%}
<h1>{{ 'HEADING_NEW_TICKET'|trans }}</h1>
<h1>{{ 'HEADING_NEW_TICKET'|trans({}, 'HackzillaTicketBundle') }}</h1>

<div class="well well-sm">
{{ form_start(form, {'method': 'POST', 'action': path('hackzilla_ticket_create')}) }}
Expand All @@ -23,10 +23,10 @@

<div class="form-group row">
<div class="col-lg-offset-2 col-lg-10 col-md-offset-2 col-md-10 col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">{{ 'BUTTON_CREATE'|trans }}</button>
<button type="submit" class="btn btn-primary">{{ 'BUTTON_CREATE'|trans({}, 'HackzillaTicketBundle') }}</button>

<a href="{{ path('hackzilla_ticket') }}" class="btn btn-default">
{{ 'BUTTON_BACK_TO_LIST'|trans }}
{{ 'BUTTON_BACK_TO_LIST'|trans({}, 'HackzillaTicketBundle') }}
</a>
</div>
</div>
Expand Down
Loading

0 comments on commit dab99ad

Please sign in to comment.