Skip to content

Commit

Permalink
feat/Added translation option for text 'segment' (#4624)
Browse files Browse the repository at this point in the history
  • Loading branch information
nithin-trenser authored Jan 3, 2025
1 parent 4ef67c0 commit 8606791
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion extensions/cornerstone/src/commandsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@cornerstonejs/tools';

import { Types as OhifTypes } from '@ohif/core';
import i18n from '@ohif/i18n';
import {
callLabelAutocompleteDialog,
showLabelAnnotationPopup,
Expand Down Expand Up @@ -902,7 +903,7 @@ function commandsModule({
segments: options.createInitialSegment
? {
1: {
label: 'Segment 1',
label: `${i18n.t('Segment')} 1`,
active: true,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Types as cstTypes,
} from '@cornerstonejs/tools';
import { PubSubService, Types as OHIFTypes } from '@ohif/core';
import i18n from '@ohif/i18n';
import { easeInOutBell, reverseEaseInOutBell } from '../../utils/transitions';
import { mapROIContoursToRTStructData } from './RTSTRUCT/mapROIContoursToRTStructData';
import { SegmentationRepresentations } from '@cornerstonejs/tools/enums';
Expand Down Expand Up @@ -361,11 +362,11 @@ class SegmentationService extends PubSubService {
options.segments && Object.keys(options.segments).length > 0
? options.segments
: {
1: {
label: 'Segment 1',
active: true,
1: {
label: `${i18n.t('Segment')} 1`,
active: true,
},
},
},
cachedStats: {
info: `S${displaySet.SeriesNumber}: ${displaySet.SeriesDescription}`,
},
Expand All @@ -382,8 +383,8 @@ class SegmentationService extends PubSubService {
segmentationId?: string;
type: SegmentationRepresentations;
} = {
type: LABELMAP,
}
type: LABELMAP,
}
): Promise<string> {
const { type } = options;
let { segmentationId } = options;
Expand Down Expand Up @@ -535,8 +536,8 @@ class SegmentationService extends PubSubService {
segmentationId?: string;
type: SegmentationRepresentations;
} = {
type: CONTOUR,
}
type: CONTOUR,
}
): Promise<string> {
const { type } = options;
let { segmentationId } = options;
Expand Down Expand Up @@ -799,7 +800,7 @@ class SegmentationService extends PubSubService {
} = {}
): void {
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);
Expand All @@ -813,7 +814,7 @@ class SegmentationService extends PubSubService {

// update the segmentation
if (!config.label) {
config.label = `Segment ${segmentIndex}`;
config.label = `${i18n.t('Segment')} ${segmentIndex}`;
}

const currentSegments = csSegmentation.segments;
Expand Down
3 changes: 2 additions & 1 deletion extensions/tmtv/src/commandsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import OHIF from '@ohif/core';
import * as cs from '@cornerstonejs/core';
import * as csTools from '@cornerstonejs/tools';
import { classes } from '@ohif/core';
import i18n from '@ohif/i18n';
import getThresholdValues from './utils/getThresholdValue';
import createAndDownloadTMTVReport from './utils/createAndDownloadTMTVReport';

Expand Down Expand Up @@ -182,7 +183,7 @@ const commandsModule = ({ servicesManager, commandsManager, extensionManager }:

const segmentationId = await segmentationService.createLabelmapForDisplaySet(displaySet, {
label: `Segmentation ${currentSegmentations.length + 1}`,
segments: { 1: { label: 'Segment 1', active: true } },
segments: { 1: { label: `${i18n.t('Segment')} 1`, active: true } },
});

segmentationService.addSegmentationRepresentation(withPTViewportId, {
Expand Down

0 comments on commit 8606791

Please sign in to comment.