From a341e57c3d428e2254659d44f77690f2a385ee9d Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Wed, 6 Sep 2023 12:06:44 +0200 Subject: [PATCH] fix: use translated dimension labels in PT DHIS2-15750 --- src/modules/pivotTable/PivotTableEngine.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/pivotTable/PivotTableEngine.js b/src/modules/pivotTable/PivotTableEngine.js index ddea5c485..d59559d2b 100644 --- a/src/modules/pivotTable/PivotTableEngine.js +++ b/src/modules/pivotTable/PivotTableEngine.js @@ -1,3 +1,4 @@ +import i18n from '@dhis2/d2-i18n' import times from 'lodash/times' import { DIMENSION_TYPE_DATA, @@ -448,27 +449,31 @@ export class PivotTableEngine { columnLevel === lastColumnLevel && this.dimensionLookup.columns[lastColumnLevel] ) { - return `${this.dimensionLookup.rows[lastRowLevel].meta.name} / ${this.dimensionLookup.columns[lastColumnLevel].meta.name}` + return `${i18n.t( + this.dimensionLookup.rows[lastRowLevel].meta.name + )} / ${i18n.t( + this.dimensionLookup.columns[lastColumnLevel].meta.name + )}` } if (lastRowLevel === -1) { - return this.dimensionLookup.columns[columnLevel].meta.name + return i18n.t(this.dimensionLookup.columns[columnLevel].meta.name) } if (lastColumnLevel === -1) { - return this.dimensionLookup.rows[rowLevel].meta.name + return i18n.t(this.dimensionLookup.rows[rowLevel].meta.name) } if ( rowLevel === lastRowLevel && this.dimensionLookup.columns[columnLevel] ) { - return this.dimensionLookup.columns[columnLevel].meta.name + return i18n.t(this.dimensionLookup.columns[columnLevel].meta.name) } if ( columnLevel === lastColumnLevel && this.dimensionLookup.rows[rowLevel] ) { - return this.dimensionLookup.rows[rowLevel].meta.name + return i18n.t(this.dimensionLookup.rows[rowLevel].meta.name) } }