Skip to content

Commit

Permalink
(BREAKING) Update i18next interpolation syntax (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasharma05 authored Oct 27, 2023
1 parent b7ea3a1 commit 20c52f5
Show file tree
Hide file tree
Showing 52 changed files with 250 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MedicationSummary: React.FC<MedicationSummaryProps> = ({ medications }) =>
&mdash; {medication.order.frequency?.display} &mdash;{' '}
{!medication.order.duration
? t('orderIndefiniteDuration', 'Indefinite duration')
: t('orderDurationAndUnit', 'for {duration} {durationUnit}', {
: t('orderDurationAndUnit', 'for {{duration}} {{durationUnit}}', {
duration: medication.order.duration,
durationUnit: medication.order.durationUnits?.display,
})}
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-active-visits-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"notes": "Notes",
"noVisitsFound": "No visits found",
"noVisitsToDisplay": "No visits to display",
"orderDurationAndUnit": "for {duration} {durationUnit}",
"orderDurationAndUnit": "for {{duration}} {{durationUnit}}",
"orderIndefiniteDuration": "Indefinite duration",
"provider": "Provider",
"refills": "Refills",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-active-visits-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"notes": "الملاحظات",
"noVisitsFound": "No visits found",
"noVisitsToDisplay": "لا زيارات للعرض",
"orderDurationAndUnit": "لمدة {duration} {durationUnit}",
"orderDurationAndUnit": "لمدة {{duration}} {{durationUnit}}",
"orderIndefiniteDuration": "مدة غير محددة",
"provider": "مقدم الخدمة",
"refills": "إعادة التعبئة",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-active-visits-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"notes": "Notes",
"noVisitsFound": "No visits found",
"noVisitsToDisplay": "No visits to display",
"orderDurationAndUnit": "for {duration} {durationUnit}",
"orderDurationAndUnit": "for {{duration}} {{durationUnit}}",
"orderIndefiniteDuration": "Indefinite duration",
"provider": "Provider",
"refills": "Refills",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-active-visits-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"notes": "Informations complémentaires",
"noVisitsFound": "No visits found",
"noVisitsToDisplay": "No visits to display",
"orderDurationAndUnit": "Pour {duration} {durationUnit}",
"orderDurationAndUnit": "Pour {{duration}} {{durationUnit}}",
"orderIndefiniteDuration": "Durée illimitée",
"provider": "Fournisseur",
"refills": "Recharges",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-active-visits-app/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"notes": "הערות",
"noVisitsFound": "No visits found",
"noVisitsToDisplay": "No visits to display",
"orderDurationAndUnit": "למשך {duration} {durationUnit}",
"orderDurationAndUnit": "למשך {{duration}} {{durationUnit}}",
"orderIndefiniteDuration": "למשך זמן בלתי מוגבל",
"provider": "ספק",
"refills": "תערובות",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ const AppointmentsMetrics: React.FC<AppointmentMetricsProps> = ({ serviceUuid })
highestServiceLoad?.count !== 0 ? t(highestServiceLoad?.serviceName) : t('serviceName', 'Service name')
}
value={highestServiceLoad?.count ?? '--'}
headerLabel={t('highestServiceVolume', 'High volume service: {time}', { time: formattedStartDate })}
headerLabel={t('highestServiceVolume', 'High volume service: {{time}}', { time: formattedStartDate })}
/>
<MetricsCard
label={t('providers', 'Providers')}
value={totalProviders}
headerLabel={t('providersAvailableToday', 'Providers available: {time}', { time: formattedStartDate })}
headerLabel={t('providersAvailableToday', 'Providers available: {{time}}', { time: formattedStartDate })}
/>
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export const EmptyState: React.FC<EmptyStateProps> = ({ headerTitle, displayText
</div>
<EmptyDataIllustration />
<p className={styles.content}>
<Trans i18nKey="emptyStateText" values={{ displayText: displayText }}>
There are no {displayText} to display
</Trans>
{t('emptyStateText', 'There are no {{displayText}} to display', { displayText })}
</p>
{scheduleType === 'Scheduled' ? (
<p className={styles.action}>
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "Duration min",
"editAppointment": "Edit Appointment",
"editAppointments": "Edit Appointment",
"emptyStateText": "There are no {displayText} to display",
"emptyStateText": "There are no {{displayText}} to display",
"encounters": "Encounters",
"encounterType": "Encounter type",
"endTime": "End Time",
Expand All @@ -73,7 +73,7 @@
"errorCreatingAppointmentService": "Error creating appointment service",
"filter": "Filter",
"gender": "Gender",
"highestServiceVolume": "High volume service: {time}",
"highestServiceVolume": "High volume service: {{time}}",
"home": "Home",
"identifier": "Identifier",
"launchFormUpForm": "Follow up",
Expand Down Expand Up @@ -102,7 +102,7 @@
"prev": "Prev",
"provider": "Provider",
"providers": "Providers",
"providersAvailableToday": "Providers available: {time}",
"providersAvailableToday": "Providers available: {{time}}",
"queueAddedSuccessfully": "",
"queueEntryError": "Error adding patient to the queue",
"reasonForChanges": "Reason For Changes",
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "المدة بالدقائق",
"editAppointment": "تعديل الموعد",
"editAppointments": "تعديل الموعد",
"emptyStateText": "لا يوجد {displayText} للعرض",
"emptyStateText": "لا يوجد {{displayText}} للعرض",
"encounters": "اللقاءات",
"encounterType": "نوع اللقاء",
"endTime": "وقت الانتهاء",
Expand All @@ -73,7 +73,7 @@
"errorCreatingAppointmentService": "Error creating appointment service",
"filter": "فلتر",
"gender": "الجنس",
"highestServiceVolume": "خدمة بأعلى حجم: {time}",
"highestServiceVolume": "خدمة بأعلى حجم: {{time}}",
"home": "الرئيسية",
"identifier": "معرف",
"launchFormUpForm": "متابعة",
Expand Down Expand Up @@ -102,7 +102,7 @@
"prev": "السابق",
"provider": "مقدم الخدمة",
"providers": "مقدمي الخدمة",
"providersAvailableToday": "المقدمون المتاحون: {time}",
"providersAvailableToday": "المقدمون المتاحون: {{time}}",
"queueAddedSuccessfully": "تمت إضافة الطابور بنجاح",
"queueEntryError": "خطأ في إضافة المريض إلى الطابور",
"reasonForChanges": "سبب التغييرات",
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "Duration min",
"editAppointment": "Edit Appointment",
"editAppointments": "Edit Appointment",
"emptyStateText": "There are no {displayText} to display",
"emptyStateText": "There are no {{displayText}} to display",
"encounters": "Encounters",
"encounterType": "Encounter type",
"endTime": "End Time",
Expand All @@ -73,7 +73,7 @@
"errorCreatingAppointmentService": "Error creating appointment service",
"filter": "Filter",
"gender": "Gender",
"highestServiceVolume": "High volume service: {time}",
"highestServiceVolume": "High volume service: {{time}}",
"home": "Home",
"identifier": "Identifier",
"launchFormUpForm": "Follow up",
Expand Down Expand Up @@ -102,7 +102,7 @@
"prev": "Prev",
"provider": "Provider",
"providers": "Providers",
"providersAvailableToday": "Providers available: {time}",
"providersAvailableToday": "Providers available: {{time}}",
"queueAddedSuccessfully": "",
"queueEntryError": "Error adding patient to the queue",
"reasonForChanges": "Reason For Changes",
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "Duración (min)",
"editAppointment": "Editar cita",
"editAppointments": "Editar cita",
"emptyStateText": "No hay {displayText} para mostrar",
"emptyStateText": "No hay {{displayText}} para mostrar",
"encounters": "Encuentros",
"encounterType": "Tipo de encuentro",
"endTime": "Hora de finalización",
Expand All @@ -73,7 +73,7 @@
"errorCreatingAppointmentService": "Error creating appointment service",
"filter": "Filtrar",
"gender": "Género",
"highestServiceVolume": "Servicio de alto volumen: {time}",
"highestServiceVolume": "Servicio de alto volumen: {{time}}",
"home": "Inicio",
"identifier": "Identificador",
"launchFormUpForm": "Seguimiento",
Expand Down Expand Up @@ -102,7 +102,7 @@
"prev": "Anterior",
"provider": "Proveedor",
"providers": "Proveedores",
"providersAvailableToday": "Proveedores disponibles: {time}",
"providersAvailableToday": "Proveedores disponibles: {{time}}",
"queueAddedSuccessfully": "",
"queueEntryError": "Error al agregar paciente a la cola",
"reasonForChanges": "Motivo de los cambios",
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "Duration min",
"editAppointment": "Edit Appointment",
"editAppointments": "Edit Appointment",
"emptyStateText": "There are no {displayText} to display",
"emptyStateText": "There are no {{displayText}} to display",
"encounters": "Encounters",
"encounterType": "Encounter type",
"endTime": "End Time",
Expand All @@ -73,7 +73,7 @@
"errorCreatingAppointmentService": "Error creating appointment service",
"filter": "Filter",
"gender": "Gender",
"highestServiceVolume": "High volume service: {time}",
"highestServiceVolume": "High volume service: {{time}}",
"home": "Home",
"identifier": "Identifier",
"launchFormUpForm": "Follow up",
Expand Down Expand Up @@ -102,7 +102,7 @@
"prev": "Prev",
"provider": "Provider",
"providers": "Providers",
"providersAvailableToday": "Providers available: {time}",
"providersAvailableToday": "Providers available: {{time}}",
"queueAddedSuccessfully": "",
"queueEntryError": "Error adding patient to the queue",
"reasonForChanges": "Reason For Changes",
Expand Down
6 changes: 3 additions & 3 deletions packages/esm-appointments-app/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "משך בדקות",
"editAppointment": "עריכת תור",
"editAppointments": "Edit Appointment",
"emptyStateText": "There are no {displayText} to display",
"emptyStateText": "There are no {{displayText}} to display",
"encounters": "פגישות",
"encounterType": "סוג הפגישה",
"endTime": "שעת סיום",
Expand All @@ -73,7 +73,7 @@
"errorCreatingAppointmentService": "Error creating appointment service",
"filter": "סינון",
"gender": "Gender",
"highestServiceVolume": "נפח שירות גבוה: {time}",
"highestServiceVolume": "נפח שירות גבוה: {{time}}",
"home": "Home",
"identifier": "מזהה",
"launchFormUpForm": "Follow up",
Expand Down Expand Up @@ -102,7 +102,7 @@
"prev": "Prev",
"provider": "ספק",
"providers": "ספקים",
"providersAvailableToday": "ספקים זמינים: {time}",
"providersAvailableToday": "ספקים זמינים: {{time}}",
"queueAddedSuccessfully": "",
"queueEntryError": "שגיאה בהוספת המטופל לתור",
"reasonForChanges": "סיבת השינויים",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-appointments-app/translations/km.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"durationMins": "រយៈពេលអប្បបរមា",
"editAppointment": "កែសម្រួលការណាត់ជួប",
"editAppointments": "Edit Appointment",
"emptyStateText": "There are no {displayText} to display",
"emptyStateText": "There are no {{displayText}} to display",
"encounters": "ការជួប",
"encounterType": "ប្រភេទជួប",
"endTime": "ពេលវេលាបញ្ចប់",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const PatientListEmptyState: React.FC<EmptyStateProps> = ({ listType, lau
<EmptyDataIllustration />
</div>
<p className={styles.content}>
{t('emptyStateText', 'There are no {listType} patient lists to display', {
{t('emptyStateText', 'There are no {{listType}} patient lists to display', {
listType: listType.toLowerCase(),
})}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('PatientListTableContainer', () => {
render(<PatientListTableContainer patientLists={[]} listType={''} />);

expect(screen.getByTitle(/empty data illustration/i)).toBeInTheDocument();
expect(screen.getByText(/there are no {listType} patient lists to display/i)).toBeInTheDocument();
expect(screen.getByText(/there are no patient lists to display/i)).toBeInTheDocument();
expect(screen.queryByRole('table')).not.toBeInTheDocument();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-list-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editList": "Edit list",
"editNameDescription": "Edit Name or Description",
"editPatientListHeader": "Edit patient list",
"emptyStateText": "There are no {listType} patient lists to display",
"emptyStateText": "There are no {{listType}} patient lists to display",
"error": "Error",
"errorAddPatientToList": "Patient not added to list",
"errorCreatePatientListDescription": "Couldn't create patient list",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-list-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editList": "تعديل القائمة",
"editNameDescription": "تعديل الاسم/ الوصف",
"editPatientListHeader": "تعديل قائمة المرضى",
"emptyStateText": "لا توجد قوائم مرضى من نوع {listType} لعرضها",
"emptyStateText": "لا توجد قوائم مرضى من نوع {{listType}} لعرضها",
"error": "خطأ",
"errorAddPatientToList": "لم يتم إضافة المريض إلى القائمة",
"errorCreatePatientListDescription": "تعذر إنشاء قائمة المرضى",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-list-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editList": "Edit list",
"editNameDescription": "Edit name or description",
"editPatientListHeader": "Edit patient list",
"emptyStateText": "There are no {listType} patient lists to display",
"emptyStateText": "There are no {{listType}} patient lists to display",
"error": "Error",
"errorAddPatientToList": "Patient not added to list",
"errorCreatePatientListDescription": "Couldn't create patient list",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-list-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editList": "Editar lista",
"editNameDescription": "Editar Nombre/Descripción",
"editPatientListHeader": "Editar lista de pacientes",
"emptyStateText": "No hay listas de pacientes {listType} para mostrar",
"emptyStateText": "No hay listas de pacientes {{listType}} para mostrar",
"error": "Error",
"errorAddPatientToList": "Paciente no agregado a la lista",
"errorCreatePatientListDescription": "No se pudo crear la lista de pacientes",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-list-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editList": "Modifier la liste",
"editNameDescription": "Modifier le Nom/ la Description",
"editPatientListHeader": "Modifier la liste des patients",
"emptyStateText": "There are no {listType} patient lists to display",
"emptyStateText": "There are no {{listType}} patient lists to display",
"error": "Erreur",
"errorAddPatientToList": "Patient non ajouté à la liste",
"errorCreatePatientListDescription": "Impossible de créer une liste de patients",
Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-list-app/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"editList": "ערוך רשימה",
"editNameDescription": "ערוך שם/ תיאור",
"editPatientListHeader": "ערוך רשימת מטופלים",
"emptyStateText": "There are no {listType} patient lists to display",
"emptyStateText": "There are no {{listType}} patient lists to display",
"error": "שגיאה",
"errorAddPatientToList": "המטופל לא נוסף לרשימה",
"errorCreatePatientListDescription": "לא ניתן ליצור רשימת מטופלים",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ export function PersonAttributeField({ fieldDefinition }: PersonAttributeFieldPr
default:
return (
<InlineNotification kind="error" title="Error">
Patient attribute type has unknown format "{personAttributeType.format}"
{t(
'unknownPatientAttributeType',
'Patient attribute type has unknown format {{personAttributeTypeFormat}}',
{
personAttributeTypeFormat: personAttributeType.format,
},
)}
</InlineNotification>
);
}
Expand All @@ -62,7 +68,7 @@ export function PersonAttributeField({ fieldDefinition }: PersonAttributeFieldPr
<div>
{fieldDefinition.showHeading && <h4 className={styles.productiveHeading02Light}>{fieldDefinition?.label}</h4>}
<InlineNotification kind="error" title={t('error', 'Error')}>
{t('unableToFetch', 'Unable to fetch person attribute type - {personattributetype}', {
{t('unableToFetch', 'Unable to fetch person attribute type - {{personattributetype}}', {
personattributetype: fieldDefinition?.label ?? fieldDefinition?.id,
})}
</InlineNotification>
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-patient-registration-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
"selectAnOption": "Select an option",
"sexFieldLabelText": "Sex",
"stroke": "Stroke",
"unableToFetch": "Unable to fetch person attribute type - {personattributetype}",
"unableToFetch": "Unable to fetch person attribute type - {{personattributetype}}",
"unknown": "Unknown",
"unknownPatientAttributeType": "Patient attribute type has unknown format {{personAttributeTypeFormat}}",
"updatePatient": "Update Patient",
"updationSuccessToastDescription": "The patient's information has been successfully updated",
"updationSuccessToastTitle": "Patient Details Updated",
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-patient-registration-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
"selectAnOption": "اختر خيارًا",
"sexFieldLabelText": "الجنس",
"stroke": "جلطة",
"unableToFetch": "تعذر الجلب نوع السمة الشخصية - {personattributetype}",
"unableToFetch": "تعذر الجلب نوع السمة الشخصية - {{personattributetype}}",
"unknown": "غير معروف",
"unknownPatientAttributeType": "Patient attribute type has unknown format {{personAttributeTypeFormat}}",
"updatePatient": "تحديث المريض",
"updationSuccessToastDescription": "تم تحديث معلومات المريض بنجاح",
"updationSuccessToastTitle": "تم تحديث تفاصيل المريض",
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-patient-registration-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
"selectAnOption": "Select an option",
"sexFieldLabelText": "Sex",
"stroke": "Stroke",
"unableToFetch": "Unable to fetch person attribute type {personattributetype}",
"unableToFetch": "Unable to fetch person attribute type {{personattributetype}}",
"unknown": "Unknown",
"unknownPatientAttributeType": "Patient attribute type has unknown format {{personAttributeTypeFormat}}",
"updatePatient": "Update Patient",
"updationSuccessToastDescription": "The patient's information has been successfully updated",
"updationSuccessToastTitle": "Patient Details Updated",
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-patient-registration-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
"selectAnOption": "Seleccionar una opción",
"sexFieldLabelText": "Sexo",
"stroke": "Ictus",
"unableToFetch": "No se puede obtener el tipo de atributo de persona {personattributetype}",
"unableToFetch": "No se puede obtener el tipo de atributo de persona {{personattributetype}}",
"unknown": "Desconocido",
"unknownPatientAttributeType": "Patient attribute type has unknown format {{personAttributeTypeFormat}}",
"updatePatient": "Paciente Actualizado",
"updationSuccessToastDescription": "La información del paciente se ha actualizado correctamente",
"updationSuccessToastTitle": "Datos del paciente actualizados",
Expand Down
Loading

0 comments on commit 20c52f5

Please sign in to comment.