From 659f1784ce2d57862a62a3b2f7815106b0ffa87a Mon Sep 17 00:00:00 2001 From: henrikmv Date: Thu, 4 Jan 2024 19:26:02 +0100 Subject: [PATCH] fix: change from records to the TET name --- i18n/en.pot | 7 +++++-- .../WithoutOrgUnitSelectedMessage.js | 15 +++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index 11ae115647..9247f16afc 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2024-01-02T15:05:21.040Z\n" -"PO-Revision-Date: 2024-01-02T15:05:21.040Z\n" +"POT-Creation-Date: 2024-01-04T18:26:05.060Z\n" +"PO-Revision-Date: 2024-01-04T18:26:05.060Z\n" msgid "Choose one or more dates..." msgstr "Choose one or more dates..." @@ -817,6 +817,9 @@ msgstr "Registered events" msgid "Please select {{category}}." msgstr "Please select {{category}}." +msgid "Or see all {{resourceType}} accessible to you in {{program}}" +msgstr "Or see all {{resourceType}} accessible to you in {{program}}" + msgid "Please select an organisation unit." msgstr "Please select an organisation unit." diff --git a/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js b/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js index 25de497359..47128aa2dc 100644 --- a/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js +++ b/src/core_modules/capture-core/components/Pages/MainPage/WithoutOrgUnitSelectedMessage/WithoutOrgUnitSelectedMessage.js @@ -3,6 +3,7 @@ import React, { useMemo } from 'react'; import { colors } from '@dhis2/ui'; import { withStyles } from '@material-ui/core'; import i18n from '@dhis2/d2-i18n'; +import { programCollection } from 'capture-core/metaDataMemoryStores/programCollection/programCollection'; import { IncompleteSelectionsMessage } from '../../../IncompleteSelectionsMessage'; import { programTypes } from '../../../../metaData'; import { useProgramInfo } from '../../../../hooks/useProgramInfo'; @@ -38,17 +39,23 @@ type Props = {| ...CssClasses, |} -const WithoutOrgUnitSelectedMessagePlain = ({ programId, setShowAccessible, classes }: Props) => { +const WithoutOrgUnitSelectedMessagePlain = ( + { programId, setShowAccessible, classes }: Props) => { // TODO - this hook breaks the app when the program is not found const { program, programType } = useProgramInfo(programId); - const messageKey = programType === programTypes.TRACKER_PROGRAM ? '[TEI]' : 'events'; + const selectedProgram = programCollection.get(programId); + // $FlowFixMe[prop-missing] + const trackedEntityTypeName = (selectedProgram?.trackedEntityType?.name || '').toLowerCase(); + + const resourceType = programType === programTypes.TRACKER_PROGRAM ? `${trackedEntityTypeName}s` : 'events'; const IncompleteSelectionMessage = useMemo(() => ( - i18n.t(`Or see all ${messageKey} accessible to you in {{program}}`, { + i18n.t('Or see all {{resourceType}} accessible to you in {{program}}', { + resourceType, program: program.name, interpolation: { escapeValue: false }, }) - ), [messageKey, program.name]); + ), [resourceType, program.name]); return (