Skip to content

Commit

Permalink
(feat) O3-4331: Add translation support for Add Patient nav action …
Browse files Browse the repository at this point in the history
…label (#1435)

* feat: add transaltion for Add Patient

* fix: fix addpatientLinkCompoent import

* Make the translation proper casing

* Rename file from component to extension

---------

Co-authored-by: Vineet Sharma <[email protected]>
  • Loading branch information
usamaidrsk and vasharma05 authored Jan 13, 2025
1 parent 1f178ae commit fc07a72
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { HeaderGlobalAction } from '@carbon/react';
import { UserFollow } from '@carbon/react/icons';
import { navigate } from '@openmrs/esm-framework';
import styles from './add-patient-link.scss';
import { useTranslation } from 'react-i18next';

export default function Root() {
const { t } = useTranslation();
const addPatient = React.useCallback(() => navigate({ to: '${openmrsSpaBase}/patient-registration' }), []);

return (
<HeaderGlobalAction
aria-label="Add Patient"
aria-labelledby="Add Patient"
aria-label={t('addPatient', 'Add patient')}
aria-labelledby={t('addPatient', 'Add patient')}
enterDelayMs={500}
name="AddPatientIcon"
onClick={addPatient}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import userEvent from '@testing-library/user-event';
import { render, screen } from '@testing-library/react';
import { navigate } from '@openmrs/esm-framework';
import Root from './add-patient-link';
import Root from './add-patient-link.extension';

const mockNavigate = jest.mocked(navigate);

Expand Down
2 changes: 1 addition & 1 deletion packages/esm-patient-registration-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { esmPatientRegistrationSchema } from './config-schema';
import { moduleName, patientRegistration } from './constants';
import { setupOffline } from './offline';
import rootComponent from './root.component';
import addPatientLinkComponent from './add-patient-link';
import addPatientLinkComponent from './add-patient-link.extension';
import editPatientDetailsButtonComponent from './widgets/edit-patient-details-button.component';
import { PatientPhotoExtension } from './patient-photo.extension';

Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-registration-app/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"addPatient": "Add patient",
"addRelationshipButtonText": "Add Relationship",
"addressHeader": "Address",
"allFieldsRequiredText": "All fields are required unless marked optional",
Expand Down

0 comments on commit fc07a72

Please sign in to comment.