From 471c1acbac1e71284e10aeaafb3780a9788ac734 Mon Sep 17 00:00:00 2001 From: Laurent Bossavit Date: Tue, 24 Apr 2018 15:43:07 +0200 Subject: [PATCH] =?UTF-8?q?:alien:=20Traduction=20des=20r=C3=A9ponses=20pl?= =?UTF-8?q?i=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/conversation/FormDecorator.js | 18 +++++++++++++----- source/locales/en.yaml | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/components/conversation/FormDecorator.js b/source/components/conversation/FormDecorator.js index 528a438db..9ab515e19 100644 --- a/source/components/conversation/FormDecorator.js +++ b/source/components/conversation/FormDecorator.js @@ -9,6 +9,7 @@ import { capitalise0 } from '../../utils' import { path } from 'ramda' import Explicable from 'Components/conversation/Explicable' import IgnoreStepButton from './IgnoreStepButton' +import { findRuleByDottedName } from 'Engine/rules' export let buildValidationFunction = valueType => { let validator = valueType ? valueType.validator : {}, @@ -28,7 +29,8 @@ export var FormDecorator = formType => RenderField => //... this helper directly to the redux state to avoid passing more props state => ({ themeColours: state.themeColours, - situationGate: state.situationGate + situationGate: state.situationGate, + flatRules: state.flatRules }), dispatch => ({ stepAction: (name, step, source) => @@ -141,16 +143,22 @@ export var FormDecorator = formType => RenderField => title, dottedName, fieldName, - fieldTitle - } = this.props + fieldTitle, + flatRules + } = this.props, + { i18n } = this.context - let answer = situationGate(fieldName) + let answer = situationGate(fieldName), + rule = findRuleByDottedName(flatRules, dottedName + ' . ' + answer), + translatedAnswer = (rule && rule.title) || i18n.t(answer) return (
{capitalise0(fieldTitle || title)} - {answer} + + {translatedAnswer} +