From 7af1f60dedc3c8fc1533fd7907ed95842ecd6546 Mon Sep 17 00:00:00 2001 From: Mael Date: Mon, 5 Mar 2018 15:11:35 +0100 Subject: [PATCH] C'est l'attribut de regle title qui est enrichi et utilise --- source/engine/rules.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/source/engine/rules.js b/source/engine/rules.js index bb0e9576b..2336709a2 100644 --- a/source/engine/rules.js +++ b/source/engine/rules.js @@ -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 })) +)