Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Début i18n #250

Merged
merged 6 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/_footer.html.twig
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<footer class="page-footer font-small">
<div class="footer-copyright text-center">
<p class="font-italic text-secondary">
Réserve Opérationnelle - Croix-Rouge Française à Paris<br />
Contribuez au projet: <a href="https://github.com/crf-devs/resop/" target="_blank" class="text-body">github.com/crf-devs/resop</a><br />
{{ 'project.description' | trans }}<br />
{{ 'project.contribute' | trans }} : <a href="https://github.com/crf-devs/resop/" target="_blank" class="text-body">github.com/crf-devs/resop</a><br />
{{ build_tag }}
</p>
</div>
Expand Down
10 changes: 5 additions & 5 deletions templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico" />
<title>ResOP - {% block title %}Welcome!{% endblock %}</title>
<title>{{ 'project.name' | trans }} - {% block title %}{{ 'nav.welcome' | trans }}!{% endblock %}</title>
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
Expand All @@ -19,16 +19,16 @@
<div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{{ path('user_home')}}">Accueil</a>
<a class="nav-link" href="{{ path('user_home')}}">{{ 'nav.home' | trans }}</a>
</li>
</ul>
<div class="my-2 my-lg-0 d-flex">
{% if not app.user %}
<a class="nav-link" href="{{ path('app_login')}}">Espace bénévole</a>
<a class="nav-link" href="{{ path('app_organization_login')}}">Espace structure</a>
<a class="nav-link" href="{{ path('app_login')}}">{{ 'nav.section.volunteer' | trans }}</a>
<a class="nav-link" href="{{ path('app_organization_login')}}">{{ 'nav.section.organization' | trans }}</a>
{% else %}
{{ app.user }}
<a class="mx-4" href="{{ logout_path() }}">Déconnexion</a>
<a class="mx-4" href="{{ logout_path() }}">{{ 'action.logout' | trans }}</a>
{% endif %}
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions templates/user/index.html.twig
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{% extends 'base.html.twig' %}

{% block title %}Espace utilisateur{% endblock %}
{% block title %}{{ 'nav.section.volunteer' | trans }}{% endblock %}

{% block body %}
{{ include('misc/flash-messages.html.twig') }}
<h1>Bienvenue, {{ app.user.fullName }}</h1>
<p>NIVOL : {{ app.user.identificationNumber }}</p>
<p><a class="btn btn-primary" href="{{ path('user_edit') }}" role="button">Modifier mes informations</a></p>
<h1>{{ 'nav.welcome' | trans }}, {{ app.user.fullName }}</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you should use a parameter with a %name% parameter, as we won't always have word + , + name.

For example : nav.welcome: Hello %name%.

{{ 'nav.welcome'|trans({'%name%': app.user.fullName)) }}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<p>{{ 'user.identificationNumber' | trans }} : {{ app.user.identificationNumber }}</p>
<p><a class="btn btn-primary" href="{{ path('user_edit') }}" role="button">{{ 'user.editMyInfo' | trans }}</a></p>

<p>Semaine actuelle : du {{ 'this week' | date('d/m/Y') }} au {{ 'sunday this week' | date('d/m/Y') }}</p>
<p><a class="btn btn-outline-primary" href="{{ path('user_availability') }}" role="button">Mes disponibilités pour la semaine courante</a></p>
<p>{{ 'calendar.week.current' | trans }} : {{ 'calendar.from' | trans }} {{ 'this week' | date('d/m/Y') }} {{ 'calendar.to' | trans }} {{ 'sunday this week' | date('d/m/Y') }}</p>
<p><a class="btn btn-outline-primary" href="{{ path('user_availability') }}" role="button">{{ 'user.availabilityCurrentWeek' | trans }}</a></p>

<p>Semaine prochaine : du {{ 'next week' | date('d/m/Y') }} au {{ 'sunday next week' | date('d/m/Y') }}</p>
<p><a class="btn btn-outline-primary" href="{{ path('user_availability', { week: 'next week'|date('o-\\WW') }) }}" role="button">Mes disponibilités pour la semaine prochaine</a></p>
<p>{{ 'calendar.week.next' | trans }} : {{ 'calendar.from' | trans }} {{ 'next week' | date('d/m/Y') }} {{ 'calendar.to' | trans }} {{ 'sunday next week' | date('d/m/Y') }}</p>
vincentchalamon marked this conversation as resolved.
Show resolved Hide resolved
<p><a class="btn btn-outline-primary" href="{{ path('user_availability', { week: 'next week'|date('o-\\WW') }) }}" role="button">{{ 'user.availabilityNextWeek' | trans }}</a></p>
{% endblock %}
14 changes: 7 additions & 7 deletions templates/user/login.html.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'base.html.twig' %}

{% block title %}Connexion{% endblock %}
{% block title %}{{ 'action.login' | trans }}{% endblock %}

{% block body %}
<form method="post">
Expand All @@ -10,24 +10,24 @@
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
{% endif %}

<h1 class="h3 mb-3 font-weight-normal">Connexion</h1>
<h1 class="h3 mb-3 font-weight-normal">{{ 'action.login' | trans }}</h1>

{{ form_start(loginForm) }}
{{ form_row(loginForm.identifier, {label: 'Numéro NIVOL ou Adresse e-mail'}) }}
{{ form_row(loginForm.birthday, {label: 'Date de naissance'}) }}
{{ form_row(loginForm.identifier, {label: 'user.login' | trans }) }}
{{ form_row(loginForm.birthday, {label: 'user.dob' | trans }) }}

<div class="mt-4 mb-2 d-flex">
<label>
<input type="checkbox" name="_remember_me"> Se souvenir de moi
<input type="checkbox" name="_remember_me"> {{ 'action.rememberMe' | trans }}
</label>
</div>

<button class="btn btn-lg btn-primary w-100" type="submit">Je me connecte</button>
<button class="btn btn-lg btn-primary w-100" type="submit">{{ 'action.loginSubmit' | trans }}</button>

{{ form_end(loginForm) }}

<p class="mt-1">
<a class="btn btn-lg btn-info w-100" href="{{ path('user_new') }}">Créer mon compte</a>
<a class="btn btn-lg btn-info w-100" href="{{ path('user_new') }}">{{ 'user.createMyAccount' | trans }}</a>
</p>
</div>
</div>
Expand Down
26 changes: 25 additions & 1 deletion translations/messages.fr.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
Submit: Enregistrer
action.login: Connexion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on yaml files, you can use objects:

action:
  login:
    connect: Connexion
    submit: Je me connecte
  logout: Déconnexion
...

action.loginSubmit: Je me connecte
action.logout: Déconnexion
action.rememberMe: Se souvenir de moi
action.submit: Enregistrer
calendar.week:
current: Semaine actuelle
next: Semaine prochaine
calendar.from: du
calendar.to: au
nav.home: Accueil
nav.section:
volunteer: Espace bénévole
organization: Espace structure
nav.welcome: Bienvenue
project.contribute: Contribuez au projet
project.description: Réserve opérationnelle - Croix-Rouge Française à Paris
project.name: ResOP
user.availabilityCurrentWeek: Mes disponibilités pour la semaine courante
user.availabilityNextWeek: Mes disponibilités pour la semaine prochaine
user.createMyAccount: Créer mon compte
user.dob: Date de naissance
user.editMyInfo: Modifier mes informations
user.login: Numéro NIVOL ou Adresse e-mail
user.identificationNumber: NIVOL