feat: ajoute la langue dans la mise en forme de SimulationValue et SimulationGoal

pull/3197/head
Alice Dahan 2024-10-15 17:05:25 +02:00 committed by liliced
parent e29101859e
commit 076b9daf40
2 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { DottedName } from 'modele-social'
import { formatValue, PublicodesExpression } from 'publicodes'
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
import { styled } from 'styled-components'
@ -51,6 +52,7 @@ export function SimulationGoal({
const dispatch = useDispatch()
const engine = useEngine()
const currentUnit = useSelector(targetUnitSelector)
const language = useTranslation().i18n.language
const evaluation = engine.evaluate({
valeur: dottedName,
arrondi: round ? 'oui' : 'non',
@ -171,6 +173,7 @@ export function SimulationGoal({
{formatValue(evaluation, {
displayedUnit,
precision: round ? 0 : 2,
language,
})}
</Body>
</Grid>

View File

@ -1,6 +1,7 @@
import { DottedName } from 'modele-social'
import { formatValue } from 'publicodes'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { useSelector } from 'react-redux'
import { styled } from 'styled-components'
@ -38,6 +39,7 @@ export function SimulationValue({
}: SimulationValueProps) {
const engine = useEngine()
const currentUnit = useSelector(targetUnitSelector)
const language = useTranslation().i18n.language
const evaluation = engine.evaluate({
valeur: dottedName,
arrondi: round ? 'oui' : 'non',
@ -87,6 +89,7 @@ export function SimulationValue({
{formatValue(evaluation, {
displayedUnit,
precision: round ? 0 : 2,
language,
})}
</StyledBody>
</Grid>