Skip to content

Commit 752a020

Browse files
committed
[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 #5376 Task: 4421055 X-original-commit: eb99bab Signed-off-by: Adrien Minne (adrm) <[email protected]>
1 parent ab456e6 commit 752a020

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/helpers/figures/charts/gauge_chart.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
DEFAULT_GAUGE_UPPER_COLOR,
66
} from "../../../constants";
77
import { BasePlugin } from "../../../plugins/base_plugin";
8+
import { _t } from "../../../translation";
89
import {
910
AddColumnsRowsCommand,
1011
ApplyRangeChange,
@@ -316,7 +317,11 @@ export function createGaugeChartRuntime(chart: GaugeChart, getters: Getters): Ga
316317

317318
return {
318319
background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
319-
title: chart.title ?? { text: "" },
320+
title: {
321+
...chart.title,
322+
// chart titles are extracted from .json files and they are translated at runtime here
323+
text: _t(chart.title.text ?? ""),
324+
},
320325
minValue: {
321326
value: minValue,
322327
label: formatValue(minValue, { locale, format }),

0 commit comments

Comments
 (0)