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

Début i18n #250

merged 6 commits into from
Apr 8, 2020

Conversation

ni-grid
Copy link
Contributor

@ni-grid ni-grid commented Apr 7, 2020

Je n'ai modifié que quelques fichiers pour valider que c'est bien ce qui est attendu

Ref #223

@@ -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


<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

translations/messages.fr.yaml Outdated Show resolved Hide resolved
@@ -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

@@ -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.

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

@ni-grid ni-grid changed the title WIP:Début i18n #223 Début i18n #223 Apr 8, 2020
@@ -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
...

<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.

Copy link
Contributor

@mRoca mRoca left a comment

Choose a reason for hiding this comment

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

Nice job ! LGTM

translations/messages.fr.yaml Outdated Show resolved Hide resolved
templates/user/index.html.twig Outdated Show resolved Hide resolved
@vincentchalamon
Copy link
Contributor

Thanks @ni-grid

@vincentchalamon vincentchalamon merged commit 8608b12 into crf-devs:master Apr 8, 2020
@mRoca mRoca changed the title Début i18n #223 Début i18n Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants