diff --git a/packages/framework/esm-framework/docs/API.md b/packages/framework/esm-framework/docs/API.md index 251061937..98b197ba9 100644 --- a/packages/framework/esm-framework/docs/API.md +++ b/packages/framework/esm-framework/docs/API.md @@ -926,7 +926,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:29](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L29) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:30](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L30) ___ @@ -2344,7 +2344,7 @@ and some other content on the right side: #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:57](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L57) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:58](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L58) ___ @@ -2367,7 +2367,7 @@ on its own, and the PageHeaderContent component is not needed. #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:89](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L89) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:90](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L90) ___ @@ -6902,7 +6902,7 @@ invalid key to this function will result in a type error. | Name | Type | Description | | :------ | :------ | :------ | -| `key` | ``"error"`` \| ``"change"`` \| ``"close"`` \| ``"other"`` \| ``"actions"`` \| ``"address"`` \| ``"age"`` \| ``"cancel"`` \| ``"confirm"`` \| ``"contactAdministratorIfIssuePersists"`` \| ``"contactDetails"`` \| ``"errorCopy"`` \| ``"female"`` \| ``"loading"`` \| ``"male"`` \| ``"patientIdentifierSticker"`` \| ``"patientLists"`` \| ``"print"`` \| ``"printError"`` \| ``"printErrorExplainer"`` \| ``"printIdentifierSticker"`` \| ``"printing"`` \| ``"relationships"`` \| ``"resetOverrides"`` \| ``"save"`` \| ``"scriptLoadingFailed"`` \| ``"scriptLoadingError"`` \| ``"seeMoreLists"`` \| ``"sex"`` \| ``"showLess"`` \| ``"showMore"`` \| ``"unknown"`` \| ``"closeAllOpenedWorkspaces"`` \| ``"closingAllWorkspacesPromptBody"`` \| ``"closingAllWorkspacesPromptTitle"`` \| ``"discard"`` \| ``"hide"`` \| ``"maximize"`` \| ``"minimize"`` \| ``"openAnyway"`` \| ``"unsavedChangesInOpenedWorkspace"`` \| ``"unsavedChangesInWorkspace"`` \| ``"unsavedChangesTitleText"`` \| ``"workspaceHeader"`` \| ``"address1"`` \| ``"address2"`` \| ``"address3"`` \| ``"address4"`` \| ``"address5"`` \| ``"address6"`` \| ``"city"`` \| ``"cityVillage"`` \| ``"country"`` \| ``"countyDistrict"`` \| ``"district"`` \| ``"postalCode"`` \| ``"state"`` \| ``"stateProvince"`` | - | +| `key` | ``"error"`` \| ``"change"`` \| ``"close"`` \| ``"other"`` \| ``"Clinic"`` \| ``"actions"`` \| ``"address"`` \| ``"age"`` \| ``"cancel"`` \| ``"confirm"`` \| ``"contactAdministratorIfIssuePersists"`` \| ``"contactDetails"`` \| ``"errorCopy"`` \| ``"female"`` \| ``"loading"`` \| ``"male"`` \| ``"patientIdentifierSticker"`` \| ``"patientLists"`` \| ``"print"`` \| ``"printError"`` \| ``"printErrorExplainer"`` \| ``"printIdentifierSticker"`` \| ``"printing"`` \| ``"relationships"`` \| ``"resetOverrides"`` \| ``"save"`` \| ``"scriptLoadingFailed"`` \| ``"scriptLoadingError"`` \| ``"seeMoreLists"`` \| ``"sex"`` \| ``"showLess"`` \| ``"showMore"`` \| ``"unknown"`` \| ``"closeAllOpenedWorkspaces"`` \| ``"closingAllWorkspacesPromptBody"`` \| ``"closingAllWorkspacesPromptTitle"`` \| ``"discard"`` \| ``"hide"`` \| ``"maximize"`` \| ``"minimize"`` \| ``"openAnyway"`` \| ``"unsavedChangesInOpenedWorkspace"`` \| ``"unsavedChangesInWorkspace"`` \| ``"unsavedChangesTitleText"`` \| ``"workspaceHeader"`` \| ``"address1"`` \| ``"address2"`` \| ``"address3"`` \| ``"address4"`` \| ``"address5"`` \| ``"address6"`` \| ``"city"`` \| ``"cityVillage"`` \| ``"country"`` \| ``"countyDistrict"`` \| ``"district"`` \| ``"postalCode"`` \| ``"state"`` \| ``"stateProvince"`` | - | | `defaultText?` | `string` | - | | `options?` | `Omit`<`TOptions`<`StringMap`\>, ``"defaultValue"`` \| ``"ns"``\> | Object passed to the i18next `t` function. See https://www.i18next.com/translation-function/essentials#overview-options for more information. `ns` and `defaultValue` are already set and may not be used. | diff --git a/packages/framework/esm-framework/docs/interfaces/PageHeaderContentProps.md b/packages/framework/esm-framework/docs/interfaces/PageHeaderContentProps.md index ee7754f57..031c55707 100644 --- a/packages/framework/esm-framework/docs/interfaces/PageHeaderContentProps.md +++ b/packages/framework/esm-framework/docs/interfaces/PageHeaderContentProps.md @@ -18,7 +18,7 @@ #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L11) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:12](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L12) ___ @@ -28,7 +28,7 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L10) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:11](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L11) ___ @@ -38,4 +38,4 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:9](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L9) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:10](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L10) diff --git a/packages/framework/esm-framework/docs/interfaces/PageHeaderWrapperProps.md b/packages/framework/esm-framework/docs/interfaces/PageHeaderWrapperProps.md index a13323983..727e6d5c1 100644 --- a/packages/framework/esm-framework/docs/interfaces/PageHeaderWrapperProps.md +++ b/packages/framework/esm-framework/docs/interfaces/PageHeaderWrapperProps.md @@ -17,7 +17,7 @@ #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:15](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L15) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:16](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L16) ___ @@ -27,4 +27,4 @@ ___ #### Defined in -[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:16](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L16) +[packages/framework/esm-styleguide/src/page-header/page-header.component.tsx:17](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx#L17) diff --git a/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx b/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx index 79d2bd4b2..bd1f45033 100644 --- a/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx +++ b/packages/framework/esm-styleguide/src/page-header/page-header.component.tsx @@ -4,6 +4,7 @@ import classNames from 'classnames'; import { getConfig } from '@openmrs/esm-config'; import { type StyleguideConfigObject } from '../config-schema'; import styles from './page-header.module.scss'; +import { type CoreTranslationKey, getCoreTranslation } from '@openmrs/esm-translations'; export interface PageHeaderContentProps { title: string | JSX.Element; @@ -99,7 +100,7 @@ export const PageHeaderContent: React.FC = ({ title, ill
{illustration}
- {config?.implementationName &&

{config.implementationName}

} + {config?.implementationName &&

{getCoreTranslation(config.implementationName as CoreTranslationKey)}

}

{title}

diff --git a/packages/framework/esm-styleguide/src/page-header/page-header.test.tsx b/packages/framework/esm-styleguide/src/page-header/page-header.test.tsx index 8979d6d65..e2cf3e76f 100644 --- a/packages/framework/esm-styleguide/src/page-header/page-header.test.tsx +++ b/packages/framework/esm-styleguide/src/page-header/page-header.test.tsx @@ -2,8 +2,10 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import { getConfig } from '@openmrs/esm-config'; import { PageHeaderContent } from './page-header.component'; +import { getCoreTranslation } from '@openmrs/esm-translations'; const mockedGetConfig = jest.mocked(getConfig); +const mockedGetCoreTranslation = jest.mocked(getCoreTranslation); jest.mock('@openmrs/esm-config', () => ({ getConfig: jest.fn(), @@ -22,6 +24,7 @@ describe('PageHeaderContent', () => { }); it('renders implementation name when provided in config', async () => { + mockedGetCoreTranslation.mockReturnValueOnce('Test Clinic'); mockedGetConfig.mockResolvedValue({ implementationName: 'Test Clinic' }); render(); diff --git a/packages/framework/esm-translations/src/translations.ts b/packages/framework/esm-translations/src/translations.ts index 1bf061d90..5d4415e47 100644 --- a/packages/framework/esm-translations/src/translations.ts +++ b/packages/framework/esm-translations/src/translations.ts @@ -42,6 +42,8 @@ export const coreTranslations = { age: 'Age', cancel: 'Cancel', change: 'Change', + // Default value for the implementationName config property + Clinic: 'Clinic', close: 'Close', confirm: 'Confirm', contactAdministratorIfIssuePersists: 'Contact your system administrator if the problem persists.', diff --git a/packages/framework/esm-translations/translations/en.json b/packages/framework/esm-translations/translations/en.json index 9750d0b66..6ae6e0fbe 100644 --- a/packages/framework/esm-translations/translations/en.json +++ b/packages/framework/esm-translations/translations/en.json @@ -12,6 +12,7 @@ "change": "Change", "city": "City", "cityVillage": "City", + "Clinic": "Clinic", "close": "Close", "closeAllOpenedWorkspaces": "Discard changes in {{count}} workspaces", "closingAllWorkspacesPromptBody": "There are unsaved changes in the following workspaces. Do you want to discard changes in the following workspaces? {{workspaceNames}}",