Skip to content

Commit

Permalink
i18n: Rename translations keys
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Feb 1, 2023
1 parent 0adf1e3 commit b110223
Show file tree
Hide file tree
Showing 33 changed files with 497 additions and 517 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Organizations/TicketsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
],
]);
}
Expand All @@ -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'),
],
]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
],
]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Tickets/ActorsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
],
]);
}
Expand All @@ -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'),
],
]);
}
Expand Down
22 changes: 11 additions & 11 deletions src/Entity/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
];
}

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

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

Expand Down
6 changes: 2 additions & 4 deletions src/Repository/RoleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:*']);

Expand Down
4 changes: 2 additions & 2 deletions templates/_modal_dialog.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
<span class="sr-only">
{{ 'Close' | trans }}
{{ 'layout.modal.close' | trans }}
</span>
</button>
</header>
Expand Down
8 changes: 4 additions & 4 deletions templates/_sidebar_settings.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<nav class="layout__sidebar flow-smaller" aria-labelledby="sidebar-settings-title">
<div id="sidebar-settings-title" class="sidebar__title">
{{ 'Settings' | trans }}
{{ 'settings.index.title' | trans }}
</div>

<ul class="sidebar flow-smaller">
Expand All @@ -18,7 +18,7 @@
{{ current == 'organizations' ? 'aria-current="page"' }}
>
{{ icon('organization') }}
{{ 'Organizations' | trans }}
{{ 'organizations.index.title' | trans }}
</a>
</li>
{% endif %}
Expand All @@ -31,7 +31,7 @@
{{ current == 'roles' ? 'aria-current="page"' }}
>
{{ icon('role') }}
{{ 'Roles' | trans }}
{{ 'roles.index.title' | trans }}
</a>
</li>
{% endif %}
Expand All @@ -44,7 +44,7 @@
{{ current == 'users' ? 'aria-current="page"' }}
>
{{ icon('user') }}
{{ 'Users' | trans }}
{{ 'users.index.title' | trans }}
</a>
</li>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/alerts/_error.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#}

<div class="alert alert--error" role="alert" data-turbo-cache="false" data-test="alert-error">
<div class="alert__title">{{ 'Error' | trans }}</div>
<div class="alert__title">{{ 'forms.error' | trans }}</div>

<p class="alert__message">
{{ message }}
Expand Down
22 changes: 11 additions & 11 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
tabindex="0"
data-turbo="false"
>
{{ 'Skip to main content' | trans }}
{{ 'layout.skip_to_main_content' | trans }}
</a>

<div
Expand All @@ -69,7 +69,7 @@
>
<span class="row__item--extend">
<span class="sr-only">
{{ 'Error' | trans }}
{{ 'layout.notifications.error' | trans }}
</span>

{{ message | trans }}
Expand All @@ -83,7 +83,7 @@
>
{{ icon('close') }}
<span class="sr-only">
{{ 'Close the notification' | trans }}
{{ 'layout.notifications.close' | trans }}
</span>
</button>
</div>
Expand All @@ -95,7 +95,7 @@
<noscript>
<div class="layout__banner layout__banner--alert">
<p class="banner__container">
{{ 'You need to activate the JavaScript in order to use Bileto.' | trans }}
{{ 'layout.activate_javascript' | trans }}
</p>
</div>
</noscript>
Expand All @@ -112,7 +112,7 @@

{% if is_granted('admin:see') %}
<a class="layout__header-anchor" href="{{ path('settings') }}">
{{ 'Settings' | trans }}
{{ 'settings.index.title' | trans }}
</a>
{% endif %}

Expand All @@ -121,10 +121,10 @@
data-controller="popup"
data-action="toggle->popup#update click@window->popup#closeOnClickOutside"
>
<summary class="popup__opener" title="{{ 'Menu of %name%' | trans({'%name%': app.user.displayName}) }}">
<summary class="popup__opener" title="{{ 'layout.user_menu_title' | trans({'name': app.user.displayName}) }}">
<span class="layout__header-avatar">{{ icon('circle-user') }}</span>
<span class="sr-only">
{{ 'Menu of %name%' | trans({'%name%': app.user.displayName}) }}
{{ 'layout.user_menu_title' | trans({'name': app.user.displayName}) }}
</span>
</summary>

Expand All @@ -133,19 +133,19 @@

<a class="popup__item" href="{{ path('profile') }}">
{{ icon('id-card') }}
{{ 'Profile' | trans }}
{{ 'profile.title' | trans }}
</a>

<a class="popup__item" href="{{ path('preferences') }}">
{{ icon('palette') }}
{{ 'Preferences' | trans }}
{{ 'preferences.title' | trans }}
</a>

<div class="popup__separator"></div>

<a class="popup__item" href="{{ path('about') }}">
{{ icon('circle-question') }}
{{ 'About Bileto' | trans }}
{{ 'about.title' | trans }}
</a>

<div class="popup__separator"></div>
Expand All @@ -154,7 +154,7 @@
<input type="hidden" name="_csrf_token" value="{{ csrf_token('logout') }}">
<button class="popup__item" id="form-logout-submit" type="submit">
{{ icon('logout') }}
{{ 'Logout' | trans }}
{{ 'layout.logout' | trans }}
</button>
</form>
</nav>
Expand Down
16 changes: 8 additions & 8 deletions templates/login/new.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% extends 'base.html.twig' %}

{% block title %}{{ 'Log in' | trans }}{% endblock %}
{% block title %}{{ 'login.title' | trans }}{% endblock %}

{% block layout_header %}
<details
Expand All @@ -17,7 +17,7 @@
<summary class="popup__opener">
<span class="button">
{{ icon('language') }}
{{ 'Language' | trans }}
{{ 'users.language' | trans }}
{{ icon('caret-down') }}
</span>
</summary>
Expand Down Expand Up @@ -47,7 +47,7 @@
<main class="layout__body layout__body--small flow login-new">
<img class="logo" src="{{ asset('logo.svg') }}" alt="Bileto" />

<h1>{{ 'Log in' | trans }}</h1>
<h1>{{ 'login.title' | trans }}</h1>

<form action="{{ path('login') }}" method="post" class="flow">
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
Expand All @@ -62,7 +62,7 @@

<div class="flow-small">
<label for="username">
{{ 'Email address' | trans }}
{{ 'users.email' | trans }}
</label>

<input
Expand All @@ -77,7 +77,7 @@

<div class="flow-small">
<label for="password">
{{ 'Password' | trans }}
{{ 'users.password' | trans }}
</label>

<div class="password-container" data-controller="password">
Expand All @@ -99,22 +99,22 @@
{{ icon('eye') }}
{{ icon('eye-slash') }}
<span class="sr-only">
{{ 'Show password as plain text. Note: this will visually expose your password.' | trans }}
{{ 'forms.show_password' | trans }}
</span>
</button>
</div>
</div>

<div class="form__actions">
<button id="form-login-submit" class="button--primary" type="submit">
{{ 'Login' | trans }}
{{ 'login.submit' | trans }}
</button>
</div>
</form>

<p class="text--small text--center">
<a href="{{ path('about') }}">
{{ 'About Bileto' | trans }}
{{ 'about.title' | trans }}
</a>
</p>
</main>
Expand Down
12 changes: 6 additions & 6 deletions templates/organizations/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% extends 'base.html.twig' %}

{% block title %}{{ 'Organizations' | trans }}{% endblock %}
{% block title %}{{ 'organizations.index.title' | trans }}{% endblock %}

{% block sidebar %}
{{ include('_sidebar_settings.html.twig', { current: 'organizations' }, with_context = false) }}
Expand All @@ -15,7 +15,7 @@
{% block body %}
<main class="layout__body flow organizations-index">
<div class="layout__body-header">
<h1>{{ 'Organizations' | trans }}</h1>
<h1>{{ 'organizations.index.title' | trans }}</h1>
</div>

<div class="wrapper-large flow">
Expand All @@ -24,7 +24,7 @@
<a class="card card--action" href="{{ path('new organization') }}">
<span>
{{ icon('plus') }}
{{ 'New organization' | trans }}
{{ 'organizations.index.new_organization' | trans }}
</span>
</a>

Expand All @@ -45,7 +45,7 @@
<div class="text--center text--small">
<a href="{{ path('new organization', { parent: organization.uid }) }}">
{{ icon('plus') }}
{{ '<span class="sr-only">New</span> sub-organization' | trans | raw }}
{{ 'organizations.index.new_sub_organization' | trans | raw }}
</a>
</div>
</div>
Expand All @@ -55,13 +55,13 @@
<div class="text--center flow-large">
<p class="placeholder" data-test="organizations-placeholder">
{{ icon('organization') }}
{{ 'No organization' | trans }}
{{ 'organizations.index.no_organizations' | trans }}
</p>

<p class="text--big">
<a class="anchor--action" href="{{ path('new organization') }}">
{{ icon('plus') }}
{{ 'New organization' | trans }}
{{ 'organizations.index.new_organization' | trans }}
</a>
</p>
</div>
Expand Down
Loading

0 comments on commit b110223

Please sign in to comment.