|
@@ -2,6 +2,7 @@
|
|
|
// Distributed under the terms of the Modified BSD License.
|
|
|
|
|
|
import { DocumentRegistry, DocumentWidget } from '@jupyterlab/docregistry';
|
|
|
+import { ITranslator, nullTranslator } from '@jupyterlab/translation';
|
|
|
|
|
|
import { classes, DockPanelSvg, LabIcon } from '@jupyterlab/ui-components';
|
|
|
|
|
@@ -91,6 +92,16 @@ export namespace ILabShell {
|
|
|
*/
|
|
|
export type AreaConfig = DockLayout.AreaConfig;
|
|
|
|
|
|
+ /**
|
|
|
+ * An options object for creating a lab shell object.
|
|
|
+ */
|
|
|
+ export type IOptions = {
|
|
|
+ /**
|
|
|
+ * The application language translator.
|
|
|
+ */
|
|
|
+ translator?: ITranslator;
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* An arguments object for the changed signals.
|
|
|
*/
|
|
@@ -185,15 +196,21 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
/**
|
|
|
* Construct a new application shell.
|
|
|
*/
|
|
|
- constructor() {
|
|
|
+ constructor(options?: ILabShell.IOptions) {
|
|
|
super();
|
|
|
this.addClass(APPLICATION_SHELL_CLASS);
|
|
|
this.id = 'main';
|
|
|
|
|
|
+ const trans = ((options && options.translator) || nullTranslator).load(
|
|
|
+ 'jupyterlab'
|
|
|
+ );
|
|
|
const headerPanel = (this._headerPanel = new BoxPanel());
|
|
|
const menuHandler = (this._menuHandler = new Private.PanelHandler());
|
|
|
menuHandler.panel.node.setAttribute('role', 'navigation');
|
|
|
- menuHandler.panel.node.setAttribute('aria-label', 'main navigation');
|
|
|
+ menuHandler.panel.node.setAttribute(
|
|
|
+ 'aria-label',
|
|
|
+ trans.__('main navigation')
|
|
|
+ );
|
|
|
const topHandler = (this._topHandler = new Private.PanelHandler());
|
|
|
topHandler.panel.node.setAttribute('role', 'banner');
|
|
|
const bottomPanel = (this._bottomPanel = new BoxPanel());
|
|
@@ -218,22 +235,28 @@ export class LabShell extends Widget implements JupyterFrontEnd.IShell {
|
|
|
leftHandler.sideBar.addClass(SIDEBAR_CLASS);
|
|
|
leftHandler.sideBar.addClass('jp-mod-left');
|
|
|
leftHandler.sideBar.node.setAttribute('role', 'complementary');
|
|
|
- leftHandler.sideBar.node.setAttribute('aria-label', 'main sidebar');
|
|
|
+ leftHandler.sideBar.node.setAttribute(
|
|
|
+ 'aria-label',
|
|
|
+ trans.__('main sidebar')
|
|
|
+ );
|
|
|
leftHandler.sideBar.contentNode.setAttribute('role', 'navigation');
|
|
|
leftHandler.sideBar.contentNode.setAttribute(
|
|
|
'aria-label',
|
|
|
- 'main sidebar navigation'
|
|
|
+ trans.__('main sidebar navigation')
|
|
|
);
|
|
|
leftHandler.stackedPanel.id = 'jp-left-stack';
|
|
|
|
|
|
rightHandler.sideBar.addClass(SIDEBAR_CLASS);
|
|
|
rightHandler.sideBar.addClass('jp-mod-right');
|
|
|
rightHandler.sideBar.node.setAttribute('role', 'complementary');
|
|
|
- rightHandler.sideBar.node.setAttribute('aria-label', 'alternate sidebar');
|
|
|
+ rightHandler.sideBar.node.setAttribute(
|
|
|
+ 'aria-label',
|
|
|
+ trans.__('alternate sidebar')
|
|
|
+ );
|
|
|
rightHandler.sideBar.contentNode.setAttribute('role', 'navigation');
|
|
|
rightHandler.sideBar.contentNode.setAttribute(
|
|
|
'aria-label',
|
|
|
- 'alternate sidebar navigation'
|
|
|
+ trans.__('alternate sidebar navigation')
|
|
|
);
|
|
|
rightHandler.stackedPanel.id = 'jp-right-stack';
|
|
|
|