Skip to content

Commit

Permalink
fix: change from records to the TET name
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikmv committed Jan 4, 2024
1 parent 85b4914 commit 659f178
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down Expand Up @@ -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."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 (
<div
Expand Down

0 comments on commit 659f178

Please sign in to comment.