i18n: fix enum values for Dossier.state

According to Rails i18n guide, enum values should be localized
as `<model>/<enum>`, not as sub-values to the attribute.

This fixes an exception in administrate when displaying a Dossier
in the Manager.

Note: we need to change the way GraphQL attributes are generated, because
`AASM::Core::State#display_name` doesn’t honor the `model/attribute.value`
convention (and instead tries to localize as `model.attribute/value`).
So instead we lookup the localized name using ActiveRecord.
This commit is contained in:
Pierre de La Morinerie 2021-05-06 12:27:34 +02:00
parent fb75f9d133
commit b8f71bd52c
4 changed files with 14 additions and 18 deletions

View file

@ -9,20 +9,16 @@ fr:
montant_projet: 'Le montant du projet'
montant_aide_demande: "Le montant daide demandée"
date_previsionnelle: "La date de début prévisionnelle"
state: &state
brouillon: "Brouillon"
en_construction: "En construction"
en_instruction: "En instruction"
accepte: "Accepté"
refuse: "Refusé"
sans_suite: "Classé sans suite"
state: "État"
autorisation_donnees: Acceptation des CGU
state/brouillon: Brouillon
state/en_construction: En construction
state/en_instruction: En instruction
state/accepte: Accepté
state/refuse: Refusé
state/sans_suite: Sans suite
dossier/state: &state
brouillon: "Brouillon"
en_construction: "En construction"
en_instruction: "En instruction"
accepte: "Accepté"
refuse: "Refusé"
sans_suite: "Classé sans suite"
traitement:
state:
<<: *state
state: "État"
traitement/state:
<<: *state