feat/Added translation option for text 'segment' (#4624)

This commit is contained in:
nithin-trenser 2025-01-03 21:08:34 +05:30 committed by GitHub
parent 4ef67c0cf7
commit 860679126a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 12 deletions

View File

@ -14,6 +14,7 @@ import {
} from '@cornerstonejs/tools'; } from '@cornerstonejs/tools';
import { Types as OhifTypes } from '@ohif/core'; import { Types as OhifTypes } from '@ohif/core';
import i18n from '@ohif/i18n';
import { import {
callLabelAutocompleteDialog, callLabelAutocompleteDialog,
showLabelAnnotationPopup, showLabelAnnotationPopup,
@ -902,7 +903,7 @@ function commandsModule({
segments: options.createInitialSegment segments: options.createInitialSegment
? { ? {
1: { 1: {
label: 'Segment 1', label: `${i18n.t('Segment')} 1`,
active: true, active: true,
}, },
} }

View File

@ -15,6 +15,7 @@ import {
Types as cstTypes, Types as cstTypes,
} from '@cornerstonejs/tools'; } from '@cornerstonejs/tools';
import { PubSubService, Types as OHIFTypes } from '@ohif/core'; import { PubSubService, Types as OHIFTypes } from '@ohif/core';
import i18n from '@ohif/i18n';
import { easeInOutBell, reverseEaseInOutBell } from '../../utils/transitions'; import { easeInOutBell, reverseEaseInOutBell } from '../../utils/transitions';
import { mapROIContoursToRTStructData } from './RTSTRUCT/mapROIContoursToRTStructData'; import { mapROIContoursToRTStructData } from './RTSTRUCT/mapROIContoursToRTStructData';
import { SegmentationRepresentations } from '@cornerstonejs/tools/enums'; import { SegmentationRepresentations } from '@cornerstonejs/tools/enums';
@ -361,11 +362,11 @@ class SegmentationService extends PubSubService {
options.segments && Object.keys(options.segments).length > 0 options.segments && Object.keys(options.segments).length > 0
? options.segments ? options.segments
: { : {
1: { 1: {
label: 'Segment 1', label: `${i18n.t('Segment')} 1`,
active: true, active: true,
},
}, },
},
cachedStats: { cachedStats: {
info: `S${displaySet.SeriesNumber}: ${displaySet.SeriesDescription}`, info: `S${displaySet.SeriesNumber}: ${displaySet.SeriesDescription}`,
}, },
@ -382,8 +383,8 @@ class SegmentationService extends PubSubService {
segmentationId?: string; segmentationId?: string;
type: SegmentationRepresentations; type: SegmentationRepresentations;
} = { } = {
type: LABELMAP, type: LABELMAP,
} }
): Promise<string> { ): Promise<string> {
const { type } = options; const { type } = options;
let { segmentationId } = options; let { segmentationId } = options;
@ -535,8 +536,8 @@ class SegmentationService extends PubSubService {
segmentationId?: string; segmentationId?: string;
type: SegmentationRepresentations; type: SegmentationRepresentations;
} = { } = {
type: CONTOUR, type: CONTOUR,
} }
): Promise<string> { ): Promise<string> {
const { type } = options; const { type } = options;
let { segmentationId } = options; let { segmentationId } = options;
@ -799,7 +800,7 @@ class SegmentationService extends PubSubService {
} = {} } = {}
): void { ): void {
if (config?.segmentIndex === 0) { if (config?.segmentIndex === 0) {
throw new Error('Segment index 0 is reserved for "no label"'); throw new Error(i18n.t('Segment') + ' index 0 is reserved for "no label"');
} }
const csSegmentation = this.getCornerstoneSegmentation(segmentationId); const csSegmentation = this.getCornerstoneSegmentation(segmentationId);
@ -813,7 +814,7 @@ class SegmentationService extends PubSubService {
// update the segmentation // update the segmentation
if (!config.label) { if (!config.label) {
config.label = `Segment ${segmentIndex}`; config.label = `${i18n.t('Segment')} ${segmentIndex}`;
} }
const currentSegments = csSegmentation.segments; const currentSegments = csSegmentation.segments;

View File

@ -2,6 +2,7 @@ import OHIF from '@ohif/core';
import * as cs from '@cornerstonejs/core'; import * as cs from '@cornerstonejs/core';
import * as csTools from '@cornerstonejs/tools'; import * as csTools from '@cornerstonejs/tools';
import { classes } from '@ohif/core'; import { classes } from '@ohif/core';
import i18n from '@ohif/i18n';
import getThresholdValues from './utils/getThresholdValue'; import getThresholdValues from './utils/getThresholdValue';
import createAndDownloadTMTVReport from './utils/createAndDownloadTMTVReport'; import createAndDownloadTMTVReport from './utils/createAndDownloadTMTVReport';
@ -182,7 +183,7 @@ const commandsModule = ({ servicesManager, commandsManager, extensionManager }:
const segmentationId = await segmentationService.createLabelmapForDisplaySet(displaySet, { const segmentationId = await segmentationService.createLabelmapForDisplaySet(displaySet, {
label: `Segmentation ${currentSegmentations.length + 1}`, label: `Segmentation ${currentSegmentations.length + 1}`,
segments: { 1: { label: 'Segment 1', active: true } }, segments: { 1: { label: `${i18n.t('Segment')} 1`, active: true } },
}); });
segmentationService.addSegmentationRepresentation(withPTViewportId, { segmentationService.addSegmentationRepresentation(withPTViewportId, {