Skip to content

Commit d38cf4c

Browse files
(fix): Resolve untranslated text and enhance workspace prompts with module name translation
1 parent 9400555 commit d38cf4c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/framework/esm-styleguide/src/workspaces/workspaces.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { type WorkspaceWindowState } from '@openmrs/esm-globals';
1010
import { navigate } from '@openmrs/esm-navigation';
1111
import { getGlobalStore, createGlobalStore } from '@openmrs/esm-state';
12-
import { getCoreTranslation } from '@openmrs/esm-translations';
12+
import { getCoreTranslation, translateFrom } from '@openmrs/esm-translations';
1313
import { useStore } from '@openmrs/esm-react-utils';
1414
import type { StoreApi } from 'zustand/vanilla';
1515

@@ -246,6 +246,7 @@ function promptBeforeLaunchingWorkspace(
246246
) {
247247
const { name, additionalProps } = newWorkspaceDetails;
248248
const newWorkspaceRegistration = getWorkspaceRegistration(name);
249+
const workspaceModuleName = workspace.moduleName;
249250

250251
const proceed = () => {
251252
closeWorkspace(workspace.name, {
@@ -259,7 +260,12 @@ function promptBeforeLaunchingWorkspace(
259260
};
260261

261262
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+
);
263269
} else {
264270
proceed();
265271
}
@@ -568,6 +574,7 @@ export function showWorkspacePrompts(
568574
promptType: PromptType,
569575
onConfirmation: () => void = () => {},
570576
workspaceTitle: string = '',
577+
workspaceModuleName: string = ' ',
571578
) {
572579
const store = getWorkspaceStore();
573580

@@ -618,7 +625,7 @@ export function showWorkspacePrompts(
618625
body: getCoreTranslation(
619626
'unsavedChangesInWorkspace',
620627
'There may be unsaved changes in {{workspaceName}}. Please save them before opening another workspace.',
621-
{ workspaceName: workspaceTitle },
628+
{ workspaceName: translateFrom(workspaceModuleName, workspaceTitle) },
622629
),
623630
onConfirm: () => {
624631
store.setState((state) => ({

0 commit comments

Comments
 (0)