diff --git a/extensions/default/package.json b/extensions/default/package.json index e9633cdc1..f47b06d1d 100644 --- a/extensions/default/package.json +++ b/extensions/default/package.json @@ -28,6 +28,8 @@ }, "peerDependencies": { "@ohif/core": "^0.50.0", + "@ohif/i18n": "^0.52.8", + "react-i18next": "^10.11.0", "prop-types": "^15.6.2", "react": "^16.13.1", "react-dom": "^16.13.1", diff --git a/extensions/default/src/ViewerLayout/Header.jsx b/extensions/default/src/ViewerLayout/Header.jsx index 3fefdbd60..1593ba893 100644 --- a/extensions/default/src/ViewerLayout/Header.jsx +++ b/extensions/default/src/ViewerLayout/Header.jsx @@ -1,26 +1,32 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; // TODO: This may fail if package is split from PWA build import { useHistory } from 'react-router-dom'; // import { NavBar, Svg, Icon, IconButton, Dropdown, useModal } from '@ohif/ui'; function Header({ children }) { + const { t } = useTranslation(); const history = useHistory(); const { show } = useModal(); const showAboutModal = () => { - const modalComponent = () =>
About modal
; + const modalComponent = () => ( +
{t('AboutModal:OHIF Viewer - About')}
+ ); show({ - title: 'About', + title: t('AboutModal:OHIF Viewer - About'), content: modalComponent, }); }; const showPreferencesModal = () => { - const modalComponent = () =>
Preferences modal
; + const modalComponent = () => ( +
{t('UserPreferencesModal:User Preferences')}
+ ); show({ - title: 'Preferences', + title: t('UserPreferencesModal:User Preferences'), content: modalComponent, }); }; @@ -58,7 +64,7 @@ function Header({ children }) {
{children}
- FOR INVESTIGATIONAL USE ONLY + {t('Header:INVESTIGATIONAL USE ONLY')} } list={[ - { title: 'About', icon: 'info', onClick: () => showAboutModal() }, { - title: 'Preferences', + title: t('Header:About'), + icon: 'info', + onClick: () => showAboutModal(), + }, + { + title: t('Header:Preferences'), icon: 'settings', onClick: () => showPreferencesModal(), },