From a071ee0f577de198d342036d6dc117820562efb8 Mon Sep 17 00:00:00 2001 From: "Dylan Kiss (dyki)" Date: Thu, 19 Dec 2024 14:00:25 +0000 Subject: [PATCH] [FIX] charts: translate gauge chart titles Currently the demo dashboards in Odoo have their gauge chart titles not translated, although they are exported for translation in the .pot file. In this commit we make them go through the `_t()` function, just like the titles of the scorecard charts. closes odoo/o-spreadsheet#5405 Task: 4421055 X-original-commit: 752a02078cf444e381641dd365cd8af1d0731c23 Signed-off-by: Adrien Minne (adrm) --- src/helpers/figures/charts/gauge_chart.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/helpers/figures/charts/gauge_chart.ts b/src/helpers/figures/charts/gauge_chart.ts index 269f2e41f7..1c4759e2a0 100644 --- a/src/helpers/figures/charts/gauge_chart.ts +++ b/src/helpers/figures/charts/gauge_chart.ts @@ -5,6 +5,7 @@ import { DEFAULT_GAUGE_UPPER_COLOR, } from "../../../constants"; import { BasePlugin } from "../../../plugins/base_plugin"; +import { _t } from "../../../translation"; import { AddColumnsRowsCommand, ApplyRangeChange, @@ -320,7 +321,11 @@ export function createGaugeChartRuntime(chart: GaugeChart, getters: Getters): Ga return { background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background, - title: chart.title ?? { text: "" }, + title: { + ...chart.title, + // chart titles are extracted from .json files and they are translated at runtime here + text: _t(chart.title.text ?? ""), + }, minValue: { value: minValue, label: formatValue(minValue, { locale, format }),