9
9
import { type WorkspaceWindowState } from '@openmrs/esm-globals' ;
10
10
import { navigate } from '@openmrs/esm-navigation' ;
11
11
import { getGlobalStore , createGlobalStore } from '@openmrs/esm-state' ;
12
- import { getCoreTranslation } from '@openmrs/esm-translations' ;
12
+ import { getCoreTranslation , translateFrom } from '@openmrs/esm-translations' ;
13
13
import { useStore } from '@openmrs/esm-react-utils' ;
14
14
import type { StoreApi } from 'zustand/vanilla' ;
15
15
@@ -246,6 +246,7 @@ function promptBeforeLaunchingWorkspace(
246
246
) {
247
247
const { name, additionalProps } = newWorkspaceDetails ;
248
248
const newWorkspaceRegistration = getWorkspaceRegistration ( name ) ;
249
+ const workspaceModuleName = workspace . moduleName ;
249
250
250
251
const proceed = ( ) => {
251
252
closeWorkspace ( workspace . name , {
@@ -259,7 +260,12 @@ function promptBeforeLaunchingWorkspace(
259
260
} ;
260
261
261
262
if ( ! canCloseWorkspaceWithoutPrompting ( workspace . name ) ) {
262
- showWorkspacePrompts ( 'closing-workspace-launching-new-workspace' , proceed , workspace . title ?? workspace . name ) ;
263
+ showWorkspacePrompts (
264
+ 'closing-workspace-launching-new-workspace' ,
265
+ proceed ,
266
+ workspace . title ?? workspace . name ,
267
+ workspaceModuleName ,
268
+ ) ;
263
269
} else {
264
270
proceed ( ) ;
265
271
}
@@ -568,6 +574,7 @@ export function showWorkspacePrompts(
568
574
promptType : PromptType ,
569
575
onConfirmation : ( ) => void = ( ) => { } ,
570
576
workspaceTitle : string = '' ,
577
+ workspaceModuleName : string = ' ' ,
571
578
) {
572
579
const store = getWorkspaceStore ( ) ;
573
580
@@ -618,7 +625,7 @@ export function showWorkspacePrompts(
618
625
body : getCoreTranslation (
619
626
'unsavedChangesInWorkspace' ,
620
627
'There may be unsaved changes in {{workspaceName}}. Please save them before opening another workspace.' ,
621
- { workspaceName : workspaceTitle } ,
628
+ { workspaceName : translateFrom ( workspaceModuleName , workspaceTitle ) } ,
622
629
) ,
623
630
onConfirm : ( ) => {
624
631
store . setState ( ( state ) => ( {
0 commit comments