diff --git a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx
index 4077f53f7f2..b3f4bbcccdb 100644
--- a/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/AreaGraph.tsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { css } from 'glamor';
import {
@@ -51,6 +52,8 @@ const CustomTooltip = ({
payload,
balanceTypeOp,
}: CustomTooltipProps) => {
+ const { t } = useTranslation();
+
if (active && payload && payload.length) {
return (
{['totalAssets', 'totalTotals'].includes(balanceTypeOp) && (
)}
{['totalDebts', 'totalTotals'].includes(balanceTypeOp) && (
)}
{['netAssets'].includes(balanceTypeOp) && (
)}
{['netDebts'].includes(balanceTypeOp) && (
)}
{['totalTotals'].includes(balanceTypeOp) && (
{amountToCurrency(payload[0].payload.totalTotals)}
diff --git a/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx b/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx
index 0928ef81351..03519f0d0c8 100644
--- a/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/BarGraph.tsx
@@ -1,5 +1,6 @@
// @ts-strict-ignore
import React, { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { css } from 'glamor';
import {
@@ -73,6 +74,8 @@ const CustomTooltip = ({
balanceTypeOp,
yAxis,
}: CustomTooltipProps) => {
+ const { t } = useTranslation();
+
if (active && payload && payload.length) {
return (
{['totalAssets', 'totalTotals'].includes(balanceTypeOp) && (
)}
{['totalDebts', 'totalTotals'].includes(balanceTypeOp) && (
)}
{['netAssets'].includes(balanceTypeOp) && (
)}
{['netDebts'].includes(balanceTypeOp) && (
)}
{['totalTotals'].includes(balanceTypeOp) && (
{amountToCurrency(payload[0].payload.totalTotals)}
diff --git a/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx b/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx
index 127f6624270..7317272ad43 100644
--- a/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/BarLineGraph.tsx
@@ -1,5 +1,6 @@
// @ts-strict-ignore
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { css } from 'glamor';
import {
@@ -37,6 +38,8 @@ type CustomTooltipProps = {
};
const CustomTooltip = ({ active, payload }: CustomTooltipProps) => {
+ const { t } = useTranslation();
+
if (active && payload && payload.length) {
return (
{
-
-
+
+ {payload[0].payload.change}}
/>
diff --git a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx
index 003d5644ca8..0ce818ab008 100644
--- a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.tsx
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import * as d from 'date-fns';
import { css } from 'glamor';
@@ -34,6 +35,8 @@ type CustomTooltipProps = TooltipProps
& {
};
function CustomTooltip({ active, payload, isConcise }: CustomTooltipProps) {
+ const { t } = useTranslation();
+
if (!active || !payload) {
return null;
}
@@ -58,24 +61,30 @@ function CustomTooltip({ active, payload, isConcise }: CustomTooltipProps) {
-
+
{amountToCurrency(data.income + data.expenses)}
}
/>
{data.transfers !== 0 && (
)}
-
+
diff --git a/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx b/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx
index dc949d4c3c4..6a180611a1a 100644
--- a/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/LineGraph.tsx
@@ -1,5 +1,6 @@
// @ts-strict-ignore
import React, { useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { css } from 'glamor';
import {
@@ -57,6 +58,7 @@ const CustomTooltip = ({
active,
payload,
}: CustomTooltipProps) => {
+ const { t } = useTranslation();
if (active && payload && payload.length) {
let sumTotals = 0;
return (
@@ -97,7 +99,7 @@ const CustomTooltip = ({
})}
{payload.length > 5 && compact && '...'}
{
@@ -97,13 +99,19 @@ export function NetWorthGraph({
{payload[0].payload.date}
-
-
+
+
{payload[0].payload.networth}}
/>
-
+
diff --git a/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx b/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
index 0b2401f44e1..a035c919b8b 100644
--- a/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
@@ -1,5 +1,6 @@
// @ts-strict-ignore
import React from 'react';
+import { useTranslation } from 'react-i18next';
import { css } from 'glamor';
import {
@@ -58,6 +59,8 @@ const CustomTooltip = ({
selection,
compare,
}: CustomTooltipProps) => {
+ const { t } = useTranslation();
+
if (active && payload && payload.length) {
const comparison =
selection === 'average'
@@ -78,16 +81,18 @@ const CustomTooltip = ({
- Day:{' '}
+ {t('Day:') + ' '}
{Number(payload[0].payload.day) >= 28
- ? '28+'
+ ? t('28+')
: payload[0].payload.day}
{payload[0].payload.months[thisMonth].cumulative ? (
)}
{payload[0].payload.months[thisMonth].cumulative ? (
{
+ const { t } = useTranslation();
if (active && payload && payload.length) {
let sumTotals = 0;
return (
@@ -103,7 +105,7 @@ const CustomTooltip = ({
})}
{payload.length > 5 && compact && '...'}
|
>
@@ -112,7 +114,7 @@ export function ReportTableHeader({
minWidth: compact ? 50 : 85,
}}
valueStyle={compactStyle}
- value="Totals"
+ value={t('Totals')}
width="flex"
/>
|
diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx
index ed192f0c4eb..5db57ad5b87 100644
--- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx
@@ -4,6 +4,7 @@ import React, {
useState,
type RefObject,
} from 'react';
+import { useTranslation } from 'react-i18next';
import {
type GroupedEntity,
@@ -63,6 +64,7 @@ export function ReportTableTotals({
style,
renderTotals,
}: ReportTableTotalsProps) {
+ const { t } = useTranslation();
const [scrollWidthTotals, setScrollWidthTotals] = useState(0);
useLayoutEffect(() => {
@@ -81,7 +83,7 @@ export function ReportTableTotals({
const metadata: GroupedEntity = {
id: '',
- name: 'Totals',
+ name: t('Totals'),
intervalData: data.intervalData,
totalAssets: data.totalAssets,
totalDebts: data.totalDebts,
diff --git a/upcoming-release-notes/3299.md b/upcoming-release-notes/3299.md
new file mode 100644
index 00000000000..713830845b2
--- /dev/null
+++ b/upcoming-release-notes/3299.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [psybers]
+---
+
+Support translations in desktop-client/components/reports/graphs.