mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
WIP translation conventions
This commit is contained in:
parent
fe6949ea26
commit
171f7585c2
107
docs/source/development/translations.rst
Normal file
107
docs/source/development/translations.rst
Normal file
@ -0,0 +1,107 @@
|
||||
Translations
|
||||
************
|
||||
|
||||
One source of truth
|
||||
===================
|
||||
|
||||
As of January 2025 we have opted to use one source of truth for translations in our backend as well as our frontend.
|
||||
You will find translations still being present in i18ns files for our vue components, but these will slowly be replaced.
|
||||
The goal is to only use the messages.{locale}.yaml files to create our translations and keys.
|
||||
|
||||
Each time we do `symfony console cache:clear` a javascript and typescript file are generated containing all the keys and the corresponding translations.
|
||||
These can then be imported into our vue components together with the `trans` method, for use in the vue templates.
|
||||
|
||||
Vue import example
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
. code-block:: js
|
||||
import {
|
||||
ACTIVITY_BLOC_PERSONS,
|
||||
ACTIVITY_BLOC_PERSONS_ASSOCIATED,
|
||||
ACTIVITY_BLOC_THIRDPARTY,
|
||||
ACTIVITY_BLOC_USERS,
|
||||
ACTIVITY_ADD_PERSONS,
|
||||
trans,
|
||||
} from "translator";
|
||||
|
||||
Setup
|
||||
=====
|
||||
|
||||
For development purposes we generally make use of the chill-bundles standalone project. Here the new translation setup will work out of the box.
|
||||
|
||||
However when working on a customer chill instance (with a root project and a chill-bundles implementation) it is required to execute the chill translations recipe
|
||||
using the command
|
||||
|
||||
Translation key conventions
|
||||
===========================
|
||||
|
||||
When adding new translation keys we have chosen to adhere to the following conventions as of April 2025.
|
||||
Older translation keys will gradually be adapted to respect these conventions.
|
||||
|
||||
Conventions
|
||||
^^^^^^^^^^^
|
||||
|
||||
Entity related messages
|
||||
-----------------------
|
||||
|
||||
Translation keys will be structured as followed as follows:
|
||||
|
||||
`[bundle].[entity].[page or component].[action / message]`
|
||||
|
||||
. code-block:: yaml
|
||||
person:
|
||||
household:
|
||||
index:
|
||||
edit_comment: "Mettre à jour le commentaire"
|
||||
|
||||
|
||||
|
||||
So the key to be used will be `person.household.index.edit_comment` when used in a twig template
|
||||
or
|
||||
`PERSON_HOUSEHOLD_INDEX_EDIT_COMMENT` when used in a vue component.
|
||||
|
||||
|
||||
Export related messages
|
||||
-----------------------
|
||||
|
||||
Translation keys will be structured as followed as follows:
|
||||
|
||||
[bundle]
|
||||
|
|
||||
|__ export
|
||||
|
|
||||
|__ ['count | list' | 'filter' | 'aggregator']
|
||||
|
|
||||
|__ [export | filter | aggregator - name] OR [ properties (end of hierarchy) ]
|
||||
|
|
||||
|__ [action / message]
|
||||
|
||||
ex. Filter
|
||||
|
||||
. code-block:: yaml
|
||||
activity:
|
||||
export:
|
||||
filter:
|
||||
by_users_job:
|
||||
title: Filtrer les échanges par type
|
||||
'Filtered activity by users job: only %jobs%': 'Filtré par métier d''au moins un utilisateur participant: seulement %jobs%'
|
||||
|
||||
ex. Export type
|
||||
|
||||
. code-block:: yaml
|
||||
activity:
|
||||
export:
|
||||
count:
|
||||
count_persons_on_activity:
|
||||
title: Nombre d'usagers concernés par les échanges
|
||||
list:
|
||||
activities_by_parcours:
|
||||
title: Liste des échanges liés à un parcours
|
||||
|
||||
ex. Export properties shared by a certain export type
|
||||
|
||||
. code-block:: yaml
|
||||
activity:
|
||||
export:
|
||||
list:
|
||||
users ids: Identifiant des utilisateurs
|
Loading…
x
Reference in New Issue
Block a user