Skip to content

Commit a071ee0

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 #5405 Task: 4421055 X-original-commit: 752a020 Signed-off-by: Adrien Minne (adrm) <[email protected]>
1 parent d2de679 commit a071ee0

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,
@@ -320,7 +321,11 @@ export function createGaugeChartRuntime(chart: GaugeChart, getters: Getters): Ga
320321

321322
return {
322323
background: getters.getStyleOfSingleCellChart(chart.background, dataRange).background,
323-
title: chart.title ?? { text: "" },
324+
title: {
325+
...chart.title,
326+
// chart titles are extracted from .json files and they are translated at runtime here
327+
text: _t(chart.title.text ?? ""),
328+
},
324329
minValue: {
325330
value: minValue,
326331
label: formatValue(minValue, { locale, format }),

0 commit comments

Comments
 (0)