Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/components/sectionList/translation/TranslationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ const validEventFields: Set<string> = new Set([
'name',
'shortName',
'description',
'executionDateLabel',
'dueDateLabel',
'eventLabel',
'eventsLabel',
'orgUnitLabel',
'relationshipLabel',
'relationshipsLabel',
'noteLabel',
'notesLabel',
])

/**
Expand Down
11 changes: 11 additions & 0 deletions src/pages/programs/EditEventProgram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ import { EventProgramFormDescriptor } from './form/eventProgram/eventProgramForm
import { StageFormValues } from './form/programStage/StageForm'
import { ProgramStageListItem } from './form/trackerProgram/ProgramStagesFormContents'

const PLURAL_LABEL_FIELD_FILTERS = [
'eventsLabel',
'relationshipsLabel',
'notesLabel',
] as const

const fieldFilters = [
...ATTRIBUTE_VALUES_FIELD_FILTERS,
...DEFAULT_FIELD_FILTERS,
Expand All @@ -51,6 +57,11 @@ const fieldFilters = [
'categoryCombo[id,displayName]',
'style[color,icon]',
'incidentDateLabel',
'eventLabel',
'orgUnitLabel',
'relationshipLabel',
'noteLabel',
...PLURAL_LABEL_FIELD_FILTERS,
'programStages[id,name,displayName,executionDateLabel,enableUserAssignment,blockEntryForm,preGenerateUID,validationStrategy,notificationTemplates[id,name,displayName,access],dataEntryForm[id,displayName,htmlCode],programStageDataElements[id,dataElement[id,displayName,valueType,optionSet],compulsory,allowProvidedElsewhere,displayInReports,allowFutureDate,skipAnalytics,skipSynchronization,renderType,sortOrder],programStageSections[id,displayName,dataElements[id]]]',
'organisationUnits[id,displayName,path]',
'sharing',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ import {
StandardFormSectionTitle,
} from '../../../../components'
import {
FEATURES,
SCHEMA_SECTIONS,
Section,
useFeatureAvailable,
useGivenShemaOrSchemaSectionHandleOrThrow,
useValidator,
} from '../../../../lib'
import { LabelField } from '../trackerProgram/fields'

export const EventProgramCustomizationFormContents = React.memo(
function EventProgramCustomizationFormContents({
Expand All @@ -24,6 +27,9 @@ export const EventProgramCustomizationFormContents = React.memo(
section?: Section
}) {
useGivenShemaOrSchemaSectionHandleOrThrow({ section })
const showPluralLabels = useFeatureAvailable(
FEATURES.customTerminologyPlurals
)
const reportDateLabelValidator = useValidator({
schemaSection: SCHEMA_SECTIONS.programStage,
property: 'executionDateLabel',
Expand Down Expand Up @@ -53,6 +59,67 @@ export const EventProgramCustomizationFormContents = React.memo(
validate={reportDateLabelValidator}
/>
</StandardFormField>

<LabelField
name="eventLabel"
label={i18n.t('Custom label for "event" (singular)')}
helpText={i18n.t('Example use: Schedule a new event', {
nsSeparator: '~:~',
})}
/>
{showPluralLabels && (
<LabelField
name="eventsLabel"
label={i18n.t('Custom label for "events" (plural)')}
helpText={i18n.t('Example use: See all events', {
nsSeparator: '~:~',
})}
/>
)}

<LabelField
name="orgUnitLabel"
label={i18n.t('Custom label for "organisation unit"')}
helpText={i18n.t(
'Used to customize the label for the organisation unit that registers the enrollment or event'
)}
/>

<LabelField
name="relationshipLabel"
label={i18n.t('Custom label for "relationship" (singular)')}
helpText={i18n.t(
'Used to customize the label for a relationship between tracked entities'
)}
/>
{showPluralLabels && (
<LabelField
name="relationshipsLabel"
label={i18n.t(
'Custom label for "relationships" (plural)'
)}
helpText={i18n.t('Example use: See all relationships', {
nsSeparator: '~:~',
})}
/>
)}

<LabelField
name="noteLabel"
label={i18n.t('Custom label for "note" (singular)')}
helpText={i18n.t(
'Used to customize the label for a note or comment added to an enrollment or event'
)}
/>
{showPluralLabels && (
<LabelField
name="notesLabel"
label={i18n.t('Custom label for "notes" (plural)')}
helpText={i18n.t('Example use: See all notes', {
nsSeparator: '~:~',
})}
/>
)}
</SectionedFormSection>
)
}
Expand Down
7 changes: 7 additions & 0 deletions src/pages/programs/form/eventProgram/EventProgramsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ const eventProgramBaseSchema = z.object({
})
.optional(),
incidentDateLabel: z.string().optional(),
eventLabel: z.string().optional(),
eventsLabel: z.string().optional(),
orgUnitLabel: z.string().optional(),
relationshipLabel: z.string().optional(),
relationshipsLabel: z.string().optional(),
noteLabel: z.string().optional(),
notesLabel: z.string().optional(),
programStages: z
.array(
z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,34 @@ export const EventProgramFormDescriptor = {
name: 'programStages[0].executionDateLabel',
label: i18n.t('Custom label for "report date"'),
},
{
name: 'eventLabel',
label: i18n.t('Custom label for "event" (singular)'),
},
{
name: 'eventsLabel',
label: i18n.t('Custom label for "events" (plural)'),
},
{
name: 'orgUnitLabel',
label: i18n.t('Custom label for "organisation unit"'),
},
{
name: 'relationshipLabel',
label: i18n.t('Custom label for "relationship" (singular)'),
},
{
name: 'relationshipsLabel',
label: i18n.t('Custom label for "relationships" (plural)'),
},
{
name: 'noteLabel',
label: i18n.t('Custom label for "note" (singular)'),
},
{
name: 'notesLabel',
label: i18n.t('Custom label for "notes" (plural)'),
},
],
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const ProgramCustomizationFormContents = React.memo(

<LabelField
name="enrollmentLabel"
label={i18n.t('Custom label for "enrollment"')}
label={i18n.t('Custom label for "enrollment" (singular)')}
helpText={i18n.t(
'Example use: See all data in this enrollment',
{ nsSeparator: '~:~' }
Expand All @@ -51,7 +51,7 @@ export const ProgramCustomizationFormContents = React.memo(
{showPluralLabels && (
<LabelField
name="enrollmentsLabel"
label={i18n.t('Custom label for "enrollment" (plural)')}
label={i18n.t('Custom label for "enrollments" (plural)')}
helpText={i18n.t('Example use: See all enrollments', {
nsSeparator: '~:~',
})}
Expand All @@ -60,15 +60,15 @@ export const ProgramCustomizationFormContents = React.memo(

<LabelField
name="eventLabel"
label={i18n.t('Custom label for "event"')}
label={i18n.t('Custom label for "event" (singular)')}
helpText={i18n.t('Example use: Schedule a new event', {
nsSeparator: '~:~',
})}
/>
{showPluralLabels && (
<LabelField
name="eventsLabel"
label={i18n.t('Custom label for "event" (plural)')}
label={i18n.t('Custom label for "events" (plural)')}
helpText={i18n.t('Example use: See all events', {
nsSeparator: '~:~',
})}
Expand All @@ -77,7 +77,7 @@ export const ProgramCustomizationFormContents = React.memo(

<LabelField
name="programStageLabel"
label={i18n.t('Custom label for "program stage"')}
label={i18n.t('Custom label for "program stage" (singular)')}
helpText={i18n.t(
'Example use: See all data in this program stage',
{ nsSeparator: '~:~' }
Expand All @@ -87,7 +87,7 @@ export const ProgramCustomizationFormContents = React.memo(
<LabelField
name="programStagesLabel"
label={i18n.t(
'Custom label for "program stage" (plural)'
'Custom label for "program stages" (plural)'
)}
helpText={i18n.t(
'Example use: See all program stages',
Expand All @@ -106,15 +106,15 @@ export const ProgramCustomizationFormContents = React.memo(

<LabelField
name="orgUnitLabel"
label={i18n.t('Custom label for "registering unit"')}
label={i18n.t('Custom label for "organisation unit"')}
helpText={i18n.t(
'Used to customize the label for the organisation unit that registers the enrollment or event'
)}
/>

<LabelField
name="relationshipLabel"
label={i18n.t('Custom label for "relationship"')}
label={i18n.t('Custom label for "relationship" (singular)')}
helpText={i18n.t(
'Used to customize the label for a relationship between tracked entities'
)}
Expand All @@ -123,7 +123,7 @@ export const ProgramCustomizationFormContents = React.memo(
<LabelField
name="relationshipsLabel"
label={i18n.t(
'Custom label for "relationship" (plural)'
'Custom label for "relationships" (plural)'
)}
helpText={i18n.t('Example use: See all relationships', {
nsSeparator: '~:~',
Expand All @@ -133,15 +133,15 @@ export const ProgramCustomizationFormContents = React.memo(

<LabelField
name="noteLabel"
label={i18n.t('Custom label for "note"')}
label={i18n.t('Custom label for "note" (singular)')}
helpText={i18n.t(
'Used to customize the label for a note or comment added to an enrollment or event'
)}
/>
{showPluralLabels && (
<LabelField
name="notesLabel"
label={i18n.t('Custom label for "note" (plural)')}
label={i18n.t('Custom label for "notes" (plural)')}
helpText={i18n.t('Example use: See all notes', {
nsSeparator: '~:~',
})}
Expand All @@ -150,15 +150,15 @@ export const ProgramCustomizationFormContents = React.memo(

<LabelField
name="trackedEntityAttributeLabel"
label={i18n.t('Custom label for "attribute"')}
label={i18n.t('Custom label for "attribute" (singular)')}
helpText={i18n.t(
'Used to customize the label for a tracked entity attribute'
)}
/>
{showPluralLabels && (
<LabelField
name="trackedEntityAttributesLabel"
label={i18n.t('Custom label for "attribute" (plural)')}
label={i18n.t('Custom label for "attributes" (plural)')}
helpText={i18n.t('Example use: See all attributes', {
nsSeparator: '~:~',
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,56 +153,59 @@ export const TrackerProgramFormDescriptor = {
},
{
name: 'enrollmentLabel',
label: i18n.t('Custom label for "enrollment"'),
label: i18n.t('Custom label for "enrollment" (singular)'),
},
{
name: 'enrollmentsLabel',
label: i18n.t('Custom label for "enrollment" (plural)'),
label: i18n.t('Custom label for "enrollments" (plural)'),
},
{
name: 'eventLabel',
label: i18n.t('Custom label for "event"'),
label: i18n.t('Custom label for "event" (singular)'),
},
{
name: 'eventsLabel',
label: i18n.t('Custom label for "event" (plural)'),
label: i18n.t('Custom label for "events" (plural)'),
},
{
name: 'programStageLabel',
label: i18n.t('Custom label for "program stage"'),
label: i18n.t('Custom label for "program stage" (singular)'),
},
{
name: 'programStagesLabel',
label: i18n.t('Custom label for "program stage" (plural)'),
label: i18n.t('Custom label for "program stages" (plural)'),
},
{
name: 'followUpLabel',
label: i18n.t('Custom label for "follow-up"'),
},
{
name: 'orgUnitLabel',
label: i18n.t('Custom label for "registering unit"'),
label: i18n.t('Custom label for "organisation unit"'),
},
{
name: 'relationshipLabel',
label: i18n.t('Custom label for "relationship"'),
label: i18n.t('Custom label for "relationship" (singular)'),
},
{
name: 'relationshipsLabel',
label: i18n.t('Custom label for "relationship" (plural)'),
label: i18n.t('Custom label for "relationships" (plural)'),
},
{
name: 'noteLabel',
label: i18n.t('Custom label for "note" (singular)'),
},
{ name: 'noteLabel', label: i18n.t('Custom label for "note"') },
{
name: 'notesLabel',
label: i18n.t('Custom label for "note" (plural)'),
label: i18n.t('Custom label for "notes" (plural)'),
},
{
name: 'trackedEntityAttributeLabel',
label: i18n.t('Custom label for "attribute"'),
label: i18n.t('Custom label for "attribute" (singular)'),
},
{
name: 'trackedEntityAttributesLabel',
label: i18n.t('Custom label for "attribute" (plural)'),
label: i18n.t('Custom label for "attributes" (plural)'),
},
],
},
Expand Down
Loading