feat(i18n): enhanced i18n support (#3761)

This commit is contained in:
Pavel authored and GitHub committed 2023-12-11 09:43:58 -05:00
1 parent 5a5c4f58af
commit d14a8f0199
55 files changed
+319 -114

No files matched your search

@@ -1,4 +1,5 @@
import { ButtonEnums } from '@ohif/ui';
import i18n from 'i18next';
const RESPONSE = {
NO_NEVER: -1,
@@ -26,24 +27,24 @@ function promptBeginTracking({ servicesManager, extensionManager }, ctx, evt) {
function _askTrackMeasurements(uiViewportDialogService, viewportId) {
return new Promise(function (resolve, reject) {
const message = 'Track measurements for this series?';
const message = i18n.t('MeasurementTable:Track measurements for this series?');
const actions = [
{
id: 'prompt-begin-tracking-cancel',
type: ButtonEnums.type.secondary,
text: 'No',
text: i18n.t('Common:No'),
value: RESPONSE.CANCEL,
},
{
id: 'prompt-begin-tracking-no-do-not-ask-again',
type: ButtonEnums.type.secondary,
text: 'No, do not ask again',
text: i18n.t('MeasurementTable:No, do not ask again'),
value: RESPONSE.NO_NEVER,
},
{
id: 'prompt-begin-tracking-yes',
type: ButtonEnums.type.primary,
text: 'Yes',
text: i18n.t('Common:Yes'),
value: RESPONSE.SET_STUDY_AND_SERIES,
},
];
@@ -1,3 +1,5 @@
import i18n from 'i18next';
const RESPONSE = {
NO_NEVER: -1,
CANCEL: 0,
@@ -32,17 +34,17 @@ function promptTrackNewStudy({ servicesManager, extensionManager }, ctx, evt) {
function _askTrackMeasurements(UIViewportDialogService, viewportId) {
return new Promise(function (resolve, reject) {
const message = 'Track measurements for this series?';
const message = i18n.t('MeasurementTable:Track measurements for this series?');
const actions = [
{ type: 'cancel', text: 'No', value: RESPONSE.CANCEL },
{ type: 'cancel', text: i18n.t('MeasurementTable:No'), value: RESPONSE.CANCEL },
{
type: 'secondary',
text: 'No, do not ask again for this series',
text: i18n.t('MeasurementTable:No, do not ask again'),
value: RESPONSE.NO_NOT_FOR_SERIES,
},
{
type: 'primary',
text: 'Yes',
text: i18n.t('MeasurementTable:Yes'),
value: RESPONSE.SET_STUDY_AND_SERIES,
},
];
@@ -1,5 +1,6 @@
import { Types } from '@ohif/core';
import { PanelMeasurementTableTracking, PanelStudyBrowserTracking } from './panels';
import i18n from 'i18next';
// TODO:
// - No loading UI exists yet
@@ -11,7 +12,7 @@ function getPanelModule({ commandsManager, extensionManager, servicesManager }):
name: 'seriesList',
iconName: 'tab-studies',
iconLabel: 'Studies',
label: 'Studies',
label: i18n.t('SidePanel:Studies'),
component: PanelStudyBrowserTracking.bind(null, {
commandsManager,
extensionManager,
@@ -23,7 +24,7 @@ function getPanelModule({ commandsManager, extensionManager, servicesManager }):
name: 'trackedMeasurements',
iconName: 'tab-linear',
iconLabel: 'Measure',
label: 'Measurements',
label: i18n.t('SidePanel:Measurements'),
component: PanelMeasurementTableTracking.bind(null, {
commandsManager,
extensionManager,
@@ -222,10 +222,10 @@ function TrackedCornerstoneViewport(props) {
patientAge: PatientAge || '',
MRN: PatientID || '',
thickness: SliceThickness ? `${parseFloat(SliceThickness).toFixed(2)}` : '',
thicknessUnits: 'mm',
thicknessUnits: t('mm'),
spacing:
SpacingBetweenSlices !== undefined
? `${parseFloat(SpacingBetweenSlices).toFixed(2)}mm`
? `${parseFloat(SpacingBetweenSlices).toFixed(2)}${t('mm')}`
: '',
scanner: ManufacturerModelName || '',
},
@@ -312,6 +312,7 @@ function _getNextMeasurementUID(
}
function _getStatusComponent(isTracked) {
const { t } = useTranslation('TrackedCornerstoneViewport');
const trackedIcon = isTracked ? 'status-tracked' : 'status-untracked';
return (
@@ -330,15 +331,11 @@ function _getStatusComponent(isTracked) {
<span className="text-common-light text-base">
{isTracked ? (
<>
Series is
<span className="font-bold text-white"> tracked</span> and can be viewed <br />{' '}
in the measurement panel
{t('Series is tracked and can be viewed in the measurement panel')}
</>
) : (
<>
Measurements for
<span className="font-bold text-white"> untracked </span>
series <br /> will not be shown in the <br /> measurements panel
{t('Measurements for untracked series will not be shown in the measurements panel')}
</>
)}
</span>