C'est l'attribut de regle title qui est enrichi et utilise
parent
de0c94a1a8
commit
7af1f60ded
|
@ -169,27 +169,25 @@ export let formatInputs = (flatRules, formValueSelector) => state => name => {
|
|||
/* Traduction */
|
||||
|
||||
export let translateAll = (translations, flatRules) => {
|
||||
let translationsOf = rule =>
|
||||
translations[rule.dottedName],
|
||||
let translationsOf = rule => translations[rule.dottedName],
|
||||
translateProp = (lang, translation) => (rule, prop) => {
|
||||
let propTrans = translation[prop+"."+lang]
|
||||
return propTrans ?
|
||||
assoc(prop, propTrans, rule) :
|
||||
rule
|
||||
let propTrans = translation[prop + '.' + lang]
|
||||
return propTrans ? assoc(prop, propTrans, rule) : rule
|
||||
},
|
||||
translateRule = (lang, translations, props) => rule => {
|
||||
let ruleTrans = translationsOf(rule)
|
||||
return ruleTrans ?
|
||||
reduce(translateProp(lang, ruleTrans), rule, props) :
|
||||
rule
|
||||
return ruleTrans
|
||||
? reduce(translateProp(lang, ruleTrans), rule, props)
|
||||
: rule
|
||||
}
|
||||
|
||||
let targets = ["titre", "description", "question", "sous-question"]
|
||||
let targets = ['title', 'description', 'question', 'sous-question']
|
||||
|
||||
return map(translateRule("en", translations, targets), flatRules)
|
||||
return map(translateRule('en', translations, targets), flatRules)
|
||||
}
|
||||
|
||||
// On enrichit la base de règles avec des propriétés dérivées de celles du YAML
|
||||
export let rules = translateAll(translations, rawRules.map(rule =>
|
||||
enrichRule(rule, { taux_versement_transport })
|
||||
))
|
||||
export let rules = translateAll(
|
||||
translations,
|
||||
rawRules.map(rule => enrichRule(rule, { taux_versement_transport }))
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue