diff --git a/packages/application-extension/src/index.ts b/packages/application-extension/src/index.ts index ca5a9322df4..f81718c0178 100644 --- a/packages/application-extension/src/index.ts +++ b/packages/application-extension/src/index.ts @@ -690,7 +690,7 @@ const title: JupyterFrontEndPlugin = { }; commands.addCommand(CommandIDs.duplicate, { - label: () => trans.__('Duplicate'), + label: () => trans.__('Make a Copy…'), isEnabled, execute: async () => { if (!isEnabled()) { diff --git a/packages/notebook-extension/src/index.ts b/packages/notebook-extension/src/index.ts index e8b85315384..941de85fb12 100644 --- a/packages/notebook-extension/src/index.ts +++ b/packages/notebook-extension/src/index.ts @@ -47,6 +47,8 @@ import { Poll } from '@lumino/polling'; import { Widget } from '@lumino/widgets'; +import { renameLabFileMenuItems } from './lab-menu-rename'; + import { TrustedComponent } from './trusted'; /** @@ -231,12 +233,12 @@ const checkpoints: JupyterFrontEndPlugin = { }; /** - * Add a command to close the browser tab when clicking on "Close and Shut Down" + * Add a command to close the browser tab when clicking on "Close and Halt" */ const closeTab: JupyterFrontEndPlugin = { id: '@jupyter-notebook/notebook-extension:close-tab', description: - 'Add a command to close the browser tab when clicking on "Close and Shut Down".', + 'Add a command to close the browser tab when clicking on "Close and Halt".', autoStart: true, requires: [IMainMenu], optional: [INotebookTracker, ISettingRegistry, ITranslator], @@ -277,8 +279,8 @@ const closeTab: JupyterFrontEndPlugin = { commands.addCommand(id, { label: () => promptForConfirmation - ? trans.__('Close and Shut Down Notebook…') - : trans.__('Close and Shut Down Notebook'), + ? trans.__('Close and Halt…') + : trans.__('Close and Halt'), execute: async () => { if (promptForConfirmation) { const fileName = @@ -935,6 +937,8 @@ const overrideMenuItems: JupyterFrontEndPlugin = { }, }); } + + void app.restored.then(() => renameLabFileMenuItems(mainMenu, trans)); }, }; diff --git a/packages/notebook-extension/src/lab-menu-rename.ts b/packages/notebook-extension/src/lab-menu-rename.ts new file mode 100644 index 00000000000..652d3691bd5 --- /dev/null +++ b/packages/notebook-extension/src/lab-menu-rename.ts @@ -0,0 +1,32 @@ +// Copyright (c) Jupyter Development Team. +// Distributed under the terms of the Modified BSD License. + +import { IMainMenu } from '@jupyterlab/mainmenu'; + +import { TranslationBundle } from '@jupyterlab/translation'; + +/** + * Rename JupyterLab-defined File menu submenus to match Classic Notebook v6 + * wording (jupyter/notebook#6398). + */ +export const renameLabFileMenuItems = ( + mainMenu: IMainMenu, + trans: TranslationBundle +): void => { + const renames: Array<{ submenuId: string; label: string }> = [ + { + submenuId: 'jp-mainmenu-file-notebookexport', + label: trans.__('Download as'), + }, + ]; + + const items = mainMenu.fileMenu.items; + for (const rename of renames) { + for (const item of items) { + if (item.type === 'submenu' && item.submenu?.id === rename.submenuId) { + item.submenu.title.label = rename.label; + break; + } + } + } +}; diff --git a/ui-tests/test/menus.spec.ts b/ui-tests/test/menus.spec.ts index 7959196a246..ba120098026 100644 --- a/ui-tests/test/menus.spec.ts +++ b/ui-tests/test/menus.spec.ts @@ -13,7 +13,7 @@ const NOTEBOOK = 'empty.ipynb'; const MENU_PATHS = [ 'File', 'File>New', - 'File>Save and Export Notebook As', + 'File>Download as', 'Edit', 'View', 'Run', diff --git a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-chromium-linux.png b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-chromium-linux.png index 67223a1df3b..69f43eea78e 100644 Binary files a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-chromium-linux.png and b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-chromium-linux.png differ diff --git a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-save-and-export-notebook-as-chromium-linux.png b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-download-as-chromium-linux.png similarity index 100% rename from ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-save-and-export-notebook-as-chromium-linux.png rename to ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-download-as-chromium-linux.png diff --git a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-download-as-firefox-linux.png b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-download-as-firefox-linux.png new file mode 100644 index 00000000000..c4401621e3f Binary files /dev/null and b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-download-as-firefox-linux.png differ diff --git a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-firefox-linux.png b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-firefox-linux.png index 3d16b71b20d..4cddeba9394 100644 Binary files a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-firefox-linux.png and b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-firefox-linux.png differ diff --git a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-new-firefox-linux.png b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-new-firefox-linux.png index b0a012c8167..c1925c463af 100644 Binary files a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-new-firefox-linux.png and b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-new-firefox-linux.png differ diff --git a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-save-and-export-notebook-as-firefox-linux.png b/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-save-and-export-notebook-as-firefox-linux.png deleted file mode 100644 index 61bb2f4a671..00000000000 Binary files a/ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-save-and-export-notebook-as-firefox-linux.png and /dev/null differ diff --git a/ui-tests/test/notebook.spec.ts b/ui-tests/test/notebook.spec.ts index 887bc72619c..cd5e62b87c6 100644 --- a/ui-tests/test/notebook.spec.ts +++ b/ui-tests/test/notebook.spec.ts @@ -156,7 +156,7 @@ test.describe('Notebook', () => { expect(await panel.screenshot()).toMatchSnapshot(imageName); }); - test('Clicking on "Close and Shut Down Notebook" should close the browser tab', async ({ + test('Clicking on "Close and Halt" should close the browser tab', async ({ page, tmpPath, }) => {