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 1 commit
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 />
{{ 'ProjectName' | trans }}<br />
{{ '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>ResOP - {% block title %}{{ 'Welcome' | trans }}!{% endblock %}</title>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add ResOP into a key ? Like project.short.title or similar

{% 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')}}">{{ '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')}}">{{ 'Section.Volunteer' | trans }}</a>
<a class="nav-link" href="{{ path('app_organization_login')}}">{{ 'Section.Organization' | trans }}</a>
{% else %}
{{ app.user }}
<a class="mx-4" href="{{ logout_path() }}">Déconnexion</a>
<a class="mx-4" href="{{ logout_path() }}">{{ '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 %}{{ '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>{{ 'Welcome' | trans }}, {{ app.user.fullName }}</h1>
<p>{{ 'UserIdentificationNumber' | trans }} : {{ app.user.identificationNumber }}</p>
<p><a class="btn btn-primary" href="{{ path('user_edit') }}" role="button">{{ '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>{{ 'Week.Current' | trans }} : {{ 'From' | trans }} {{ 'this week' | date('d/m/Y') }} {{ 'To' | trans }} {{ 'sunday this week' | date('d/m/Y') }}</p>
<p><a class="btn btn-outline-primary" href="{{ path('user_availability') }}" role="button">{{ 'UserAvailabilityCurrentWeek' | 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>{{ 'Week.Next' | trans }} : {{ 'From' | trans }} {{ 'next week' | date('d/m/Y') }} {{ 'To' | trans }} {{ 'sunday next week' | date('d/m/Y') }}</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

you can maybe use a form-to translation with 2 parameters

<p><a class="btn btn-outline-primary" href="{{ path('user_availability', { week: 'next week'|date('o-\\WW') }) }}" role="button">{{ 'UserAvailabilityNextWeek' | 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 %}{{ '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">{{ '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: 'UserLogin' | trans }) }}
{{ form_row(loginForm.birthday, {label: '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"> {{ '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">{{ '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') }}">{{ 'CreateMyAccount' | trans }}</a>
</p>
</div>
</div>
Expand Down
23 changes: 23 additions & 0 deletions translations/messages.fr.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
Contribute: "Contribuez au projet\xA0:"
Copy link
Contributor

Choose a reason for hiding this comment

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

you should use lower & snake case

Copy link
Contributor

Choose a reason for hiding this comment

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

or camelCame, but without upper case on first letter

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to add \xA0 : if we need to have non-breaking spaces, we should use css instead

Copy link
Contributor

Choose a reason for hiding this comment

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

In projects that im working keys are camelCase with kind of namespaces to start the string example :
user.firstName
project.shortTitle
project.title

Thats very convenient when you are looking for existing keys imo

Copy link
Contributor

Choose a reason for hiding this comment

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

sure, let's do it! But as you said, the first letter is always a lowercase one

CreateMyAccount: Créer mon compte
DoB: Date de naissance
EditMyInfo: Modifier mes informations
From: du
Home: Accueil
Login: Connexion
LoginSubmit: Je me connecte
Logout: Déconnexion
ProjectName: Réserve opérationnelle - Croix-Rouge Française à Paris
RememberMe: Se souvenir de moi
Section:
Volunteer: Espace bénévole
Organization: Espace structure
Submit: Enregistrer
To: au
UserAvailabilityCurrentWeek: Mes disponibilités pour la semaine courante
UserAvailabilityNextWeek: Mes disponibilités pour la semaine prochaine
UserLogin: Numéro NIVOL ou Adresse e-mail
UserIdentificationNumber: NIVOL
Week:
Current: Semaine actuelle
Next: Semaine prochaine
Welcome: Bienvenue
ni-grid marked this conversation as resolved.
Show resolved Hide resolved