From ef315c925087f430f1c5329e7f76c6863dcfbe8b Mon Sep 17 00:00:00 2001 From: Hugo <hnouts.dev@gmail.com> Date: Thu, 22 Apr 2021 11:48:08 +0200 Subject: [PATCH] corrections --- src/components/CommonKit/Spinner/Spinner.spec.tsx | 10 ++++++++++ src/components/CommonKit/Spinner/Spinner.tsx | 8 +++++++- src/components/FluidChart/FluidChart.tsx | 6 +++++- src/components/Splash/SplashScreen.tsx | 1 - src/locales/fr.json | 8 ++++++-- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/components/CommonKit/Spinner/Spinner.spec.tsx b/src/components/CommonKit/Spinner/Spinner.spec.tsx index 868a8370c..ff1327a0d 100644 --- a/src/components/CommonKit/Spinner/Spinner.spec.tsx +++ b/src/components/CommonKit/Spinner/Spinner.spec.tsx @@ -2,6 +2,16 @@ import React from 'react' import { mount } from 'enzyme' import Spinner from './Spinner' +jest.mock('cozy-ui/transpiled/react/I18n', () => { + return { + useI18n: jest.fn(() => { + return { + t: (str: string) => str, + } + }), + } +}) + describe('Spinner component test ', () => { const mockProps = { size: 14, diff --git a/src/components/CommonKit/Spinner/Spinner.tsx b/src/components/CommonKit/Spinner/Spinner.tsx index 741c273c5..6c9ab1f66 100644 --- a/src/components/CommonKit/Spinner/Spinner.tsx +++ b/src/components/CommonKit/Spinner/Spinner.tsx @@ -1,13 +1,19 @@ import React from 'react' import CircularProgress from '@material-ui/core/CircularProgress' +import { useI18n } from 'cozy-ui/transpiled/react/I18n' interface SpinnerProps { size: number | string } const Spinner: React.FC<SpinnerProps> = ({ size }: SpinnerProps) => { + const { t } = useI18n() return ( - <CircularProgress size={size} aria-label="Chargement" title="Chargement" /> + <CircularProgress + size={size} + aria-label={t('common.accessibility.loading')} + title={t('common.accessibility.loading')} + /> ) } diff --git a/src/components/FluidChart/FluidChart.tsx b/src/components/FluidChart/FluidChart.tsx index 9aedf1f65..9ff72d3d1 100644 --- a/src/components/FluidChart/FluidChart.tsx +++ b/src/components/FluidChart/FluidChart.tsx @@ -137,7 +137,11 @@ const FluidChart: React.FC<FluidChartProps> = ({ <Switch fluidType={fluidType} checked={showCompare} - inputProps={{ 'aria-label': 'Checkbox' }} + inputProps={{ + 'aria-label': t( + 'consumption.accessibility.checkbox_compare' + ), + }} /> <span className={ diff --git a/src/components/Splash/SplashScreen.tsx b/src/components/Splash/SplashScreen.tsx index f1d24f441..44b1ba189 100644 --- a/src/components/Splash/SplashScreen.tsx +++ b/src/components/Splash/SplashScreen.tsx @@ -23,7 +23,6 @@ const SplashScreen: React.FC = () => { <img src={logos} alt="ensemble de logos" /> </div> </div> - {/* <div className="splash-footer"></div> */} </> ) } diff --git a/src/locales/fr.json b/src/locales/fr.json index e54b7b749..f4612ee9f 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -16,7 +16,10 @@ "title_options": "Options", "title_profiletype": "Ajuster mon profil", "title_faq": "FAQ", - "title_legal_notice": "Mentions légales" + "title_legal_notice": "Mentions légales", + "accessibility": { + "loading": "Chargement" + } }, "FLUID": { "ELECTRICITY": { @@ -213,7 +216,8 @@ "button_previous_period": "Afficher la période précédente", "button_next_period": "Afficher la période suivante", "button_previous_value": "Sélectionner la valeur précédente", - "button_next_value": "Sélectionner la valeur suivante" + "button_next_value": "Sélectionner la valeur suivante", + "checkbox_compare": "Bouton checkbox" } }, "consumption_details": { -- GitLab