From d9e8ecc126575a999342b325da53e53c1c3143f8 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Wed, 1 Nov 2023 15:57:49 -0400 Subject: [PATCH] fix: use right translations for right keys in ChartTree --- src/js/components/Overview/Drawer/ChartTree.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/js/components/Overview/Drawer/ChartTree.tsx b/src/js/components/Overview/Drawer/ChartTree.tsx index d7ec1bf2..2f5608fc 100644 --- a/src/js/components/Overview/Drawer/ChartTree.tsx +++ b/src/js/components/Overview/Drawer/ChartTree.tsx @@ -4,7 +4,7 @@ import { InputNumber, Tree, TreeProps } from 'antd'; import { useTranslation } from 'react-i18next'; import { rearrange, setDisplayedCharts, setChartWidth } from '@/features/data/data.store'; -import { NON_DEFAULT_TRANSLATION } from '@/constants/configConstants'; +import { DEFAULT_TRANSLATION, NON_DEFAULT_TRANSLATION } from '@/constants/configConstants'; import { ChartDataField } from '@/types/data'; interface MappedChartItem { @@ -14,14 +14,16 @@ interface MappedChartItem { const ChartTree = ({ charts, section }: ChartTreeProps) => { const dispatch = useDispatch(); - const { t } = useTranslation(NON_DEFAULT_TRANSLATION); + + const { t } = useTranslation(DEFAULT_TRANSLATION); + const { t: td } = useTranslation(NON_DEFAULT_TRANSLATION); const allCharts: MappedChartItem[] = useMemo( () => charts.map(({ field: { title }, id, width }) => ({ title: (
- {t(title)} + {td(title)} {t('Width')}:{' '} { ), key: id, })), - [charts, t] + [charts, t, td] ); const onChartDrop: TreeProps['onDrop'] = useMemo(() => {