Skip to content

Commit

Permalink
fix: use translated dimension labels in PT DHIS2-15750
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Sep 14, 2023
1 parent 63f523c commit a341e57
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/modules/pivotTable/PivotTableEngine.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import i18n from '@dhis2/d2-i18n'
import times from 'lodash/times'
import {
DIMENSION_TYPE_DATA,
Expand Down Expand Up @@ -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)
}
}

Expand Down

0 comments on commit a341e57

Please sign in to comment.