Skip to content

Commit

Permalink
[FIX] charts: translate gauge chart titles
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dylankiss committed Jan 6, 2025
1 parent d2de679 commit a071ee0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/helpers/figures/charts/gauge_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DEFAULT_GAUGE_UPPER_COLOR,
} from "../../../constants";
import { BasePlugin } from "../../../plugins/base_plugin";
import { _t } from "../../../translation";
import {
AddColumnsRowsCommand,
ApplyRangeChange,
Expand Down Expand Up @@ -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 }),
Expand Down

0 comments on commit a071ee0

Please sign in to comment.