-
Notifications
You must be signed in to change notification settings - Fork 20
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
Début i18n #250
Conversation
translations/messages.fr.yaml
Outdated
@@ -1 +1,24 @@ | |||
Contribute: "Contribuez au projet\xA0:" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
templates/user/index.html.twig
Outdated
|
||
<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> |
There was a problem hiding this comment.
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
templates/base.html.twig
Outdated
@@ -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> |
There was a problem hiding this comment.
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
translations/messages.fr.yaml
Outdated
@@ -1 +1,24 @@ | |||
Contribute: "Contribuez au projet\xA0:" |
There was a problem hiding this comment.
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
translations/messages.fr.yaml
Outdated
@@ -1 +1,25 @@ | |||
Submit: Enregistrer | |||
action.login: Connexion |
There was a problem hiding this comment.
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
...
templates/user/index.html.twig
Outdated
<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> |
There was a problem hiding this comment.
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)) }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job ! LGTM
Thanks @ni-grid |
Je n'ai modifié que quelques fichiers pour valider que c'est bien ce qui est attendu
Ref #223