From 5a91391272022aab14081ba65e0b103693e01daa Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Tue, 5 Mar 2024 12:57:59 +0100 Subject: [PATCH] fix: use translated title and subtitle when available (DHIS2-16216) (#1597) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jan Henrik Ă˜verland --- .../config/adapters/dhis_highcharts/subtitle/index.js | 7 +++++-- .../config/adapters/dhis_highcharts/title/index.js | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js b/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js index 585842325..9d2dc1bc7 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +++ b/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js @@ -50,8 +50,11 @@ export default function (series, layout, metaData, dashboard) { } // DHIS2-578: allow for optional custom subtitle - if (isString(layout.subtitle)) { - subtitle.text = layout.subtitle + const customSubtitle = + (layout.subtitle && layout.displaySubtitle) || layout.subtitle + + if (isString(customSubtitle) && customSubtitle.length) { + subtitle.text = customSubtitle } else { const filterTitle = getFilterText(layout.filters, metaData) diff --git a/src/visualizations/config/adapters/dhis_highcharts/title/index.js b/src/visualizations/config/adapters/dhis_highcharts/title/index.js index 3a42cb5f7..e4e4f1a4a 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/title/index.js +++ b/src/visualizations/config/adapters/dhis_highcharts/title/index.js @@ -55,8 +55,10 @@ export default function (layout, metaData, dashboard) { return title } - if (isString(layout.title) && layout.title.length) { - title.text = layout.title + const customTitle = (layout.title && layout.displayTitle) || layout.title + + if (isString(customTitle) && customTitle.length) { + title.text = customTitle } else { switch (layout.type) { case VIS_TYPE_GAUGE: