Skip to content

Commit

Permalink
Merge pull request #3286 from jtpio/translator
Browse files Browse the repository at this point in the history
Add support for localization to the lab extension
  • Loading branch information
jasongrout authored Oct 12, 2021
2 parents 3558ce6 + da7d7ad commit 441135a
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 3 deletions.
1 change: 1 addition & 0 deletions jupyterlab_widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"@jupyterlab/rendermime-interfaces": "^3.0.0",
"@jupyterlab/services": "^6.0.0",
"@jupyterlab/settingregistry": "^3.0.0",
"@jupyterlab/translation": "^3.0.0",
"@lumino/algorithm": "^1.1.0",
"@lumino/coreutils": "^1.3.0",
"@lumino/disposable": "^1.1.1",
Expand Down
15 changes: 12 additions & 3 deletions jupyterlab_widgets/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { JUPYTER_CONTROLS_VERSION } from '@jupyter-widgets/controls/lib/version'
import '@jupyter-widgets/base/css/index.css';
import '@jupyter-widgets/controls/css/widgets-base.css';
import { KernelMessage } from '@jupyterlab/services';
import { ITranslator, nullTranslator } from '@jupyterlab/translation';

const WIDGET_REGISTRY: base.IWidgetRegistryData[] = [];

Expand Down Expand Up @@ -146,7 +147,13 @@ export function registerWidgetManager(
const plugin: JupyterFrontEndPlugin<base.IJupyterWidgetRegistry> = {
id: '@jupyter-widgets/jupyterlab-manager:plugin',
requires: [IRenderMimeRegistry],
optional: [INotebookTracker, ISettingRegistry, IMainMenu, ILoggerRegistry],
optional: [
INotebookTracker,
ISettingRegistry,
IMainMenu,
ILoggerRegistry,
ITranslator,
],
provides: base.IJupyterWidgetRegistry,
activate: activateWidgetExtension,
autoStart: true,
Expand All @@ -167,9 +174,11 @@ function activateWidgetExtension(
tracker: INotebookTracker | null,
settingRegistry: ISettingRegistry | null,
menu: IMainMenu | null,
loggerRegistry: ILoggerRegistry | null
loggerRegistry: ILoggerRegistry | null,
translator: ITranslator | null
): base.IJupyterWidgetRegistry {
const { commands } = app;
const trans = (translator ?? nullTranslator).load('jupyterlab_widgets');

const bindUnhandledIOPubMessageSignal = (nb: NotebookPanel): void => {
if (!loggerRegistry) {
Expand Down Expand Up @@ -250,7 +259,7 @@ function activateWidgetExtension(
if (settingRegistry !== null) {
// Add a command for automatically saving (jupyter-)widget state.
commands.addCommand('@jupyter-widgets/jupyterlab-manager:saveWidgetState', {
label: 'Save Widget State Automatically',
label: trans.__('Save Widget State Automatically'),
execute: (args) => {
return settingRegistry
.set(plugin.id, 'saveState', !SETTINGS.saveState)
Expand Down
88 changes: 88 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,19 @@
path-browserify "^1.0.0"
url-parse "~1.5.1"

"@jupyterlab/coreutils@^5.1.12":
version "5.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/coreutils/-/coreutils-5.1.12.tgz#eb08aa4bf68912b6188d16bce402e737dedccd84"
integrity sha512-gZHFekV8XdP4naH+5q7l6v8TVsUgJk16OpgLLCdOOGuwFOW7zduBe1td6Z820brsmnqb1kg2jBcxl0RwVw7tLQ==
dependencies:
"@lumino/coreutils" "^1.5.3"
"@lumino/disposable" "^1.4.3"
"@lumino/signaling" "^1.4.3"
minimist "~1.2.0"
moment "^2.24.0"
path-browserify "^1.0.0"
url-parse "~1.5.1"

"@jupyterlab/docmanager@^3.0.11":
version "3.0.11"
resolved "https://registry.npmjs.org/@jupyterlab/docmanager/-/docmanager-3.0.11.tgz#dd30f93a9590369812f986198fc4c70f8452d8ca"
Expand Down Expand Up @@ -611,6 +624,13 @@
dependencies:
"@lumino/coreutils" "^1.5.3"

"@jupyterlab/nbformat@^3.1.12":
version "3.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-3.1.12.tgz#96effa28062f49cd8543d78929d6106ad6e76b3d"
integrity sha512-/c9MiQRMg/C7GQMmK4hRJkeE3+48HlC7ipVTUl4mXhEkWq+9v7loKwT6CzGAoxQrpdTf0/+NiCxF1TqYFoJxPQ==
dependencies:
"@lumino/coreutils" "^1.5.3"

"@jupyterlab/notebook@^3.0.0":
version "3.0.11"
resolved "https://registry.npmjs.org/@jupyterlab/notebook/-/notebook-3.0.11.tgz#2fc2adbea1133e16554f99bfb3f0ae81bbf8ac91"
Expand Down Expand Up @@ -650,6 +670,17 @@
"@lumino/messaging" "^1.4.3"
"@lumino/signaling" "^1.4.3"

"@jupyterlab/observables@^4.1.12":
version "4.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/observables/-/observables-4.1.12.tgz#62c5484755b0d15a0bf5d323893397900ebe8508"
integrity sha512-mfkV7USTedOGx8LrCYfZ/1DnZ8Gm9BXLtqbBcU/PETIZnFtqrWKMdC0W4n0jxMiiyVTuPNntePftC3m1fm+u5w==
dependencies:
"@lumino/algorithm" "^1.3.3"
"@lumino/coreutils" "^1.5.3"
"@lumino/disposable" "^1.4.3"
"@lumino/messaging" "^1.4.3"
"@lumino/signaling" "^1.4.3"

"@jupyterlab/outputarea@^3.0.0", "@jupyterlab/outputarea@^3.0.10":
version "3.0.10"
resolved "https://registry.npmjs.org/@jupyterlab/outputarea/-/outputarea-3.0.10.tgz#3e04a0fffd0175eca60ea7781a3b70a924d8779f"
Expand Down Expand Up @@ -718,6 +749,24 @@
node-fetch "^2.6.0"
ws "^7.2.0"

"@jupyterlab/services@^6.1.12":
version "6.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/services/-/services-6.1.12.tgz#b2ddb169579ef3688e4ec428074e1bc2bf1bbbfa"
integrity sha512-0I7tHcT9rOqnD3+YUSBz9RWuOSIGAyAsa3dJpZZ6hHzTxx/H8mkGMVFan3/gL7XWScCMlTkTd4GBNwoo/unV0A==
dependencies:
"@jupyterlab/coreutils" "^5.1.12"
"@jupyterlab/nbformat" "^3.1.12"
"@jupyterlab/observables" "^4.1.12"
"@jupyterlab/settingregistry" "^3.1.12"
"@jupyterlab/statedb" "^3.1.12"
"@lumino/algorithm" "^1.3.3"
"@lumino/coreutils" "^1.5.3"
"@lumino/disposable" "^1.4.3"
"@lumino/polling" "^1.3.3"
"@lumino/signaling" "^1.4.3"
node-fetch "^2.6.0"
ws "^7.4.6"

"@jupyterlab/settingregistry@^3.0.0", "@jupyterlab/settingregistry@^3.0.6":
version "3.0.6"
resolved "https://registry.npmjs.org/@jupyterlab/settingregistry/-/settingregistry-3.0.6.tgz#000cd9dc4984a1ccac01d73c7967893befe14b8d"
Expand All @@ -731,6 +780,19 @@
ajv "^6.12.3"
json5 "^2.1.1"

"@jupyterlab/settingregistry@^3.1.12":
version "3.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/settingregistry/-/settingregistry-3.1.12.tgz#a6a1f1ae3fa90022363d9c3b874b2089895f5d5d"
integrity sha512-cwqBoE4S2n5F/Qbwz2o6sDAeRh/lcgGdualyJfPAHOJruloHrLzQLrwdN8duq411s99p34T4PixoLKQqTIdb5A==
dependencies:
"@jupyterlab/statedb" "^3.1.12"
"@lumino/commands" "^1.12.0"
"@lumino/coreutils" "^1.5.3"
"@lumino/disposable" "^1.4.3"
"@lumino/signaling" "^1.4.3"
ajv "^6.12.3"
json5 "^2.1.1"

"@jupyterlab/statedb@^3.0.6":
version "3.0.6"
resolved "https://registry.npmjs.org/@jupyterlab/statedb/-/statedb-3.0.6.tgz#d331c815496f80083d53277e1972095da954f31f"
Expand All @@ -742,6 +804,17 @@
"@lumino/properties" "^1.2.3"
"@lumino/signaling" "^1.4.3"

"@jupyterlab/statedb@^3.1.12":
version "3.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/statedb/-/statedb-3.1.12.tgz#46852261fec2c0a35da80d39b938a12c1fbe1225"
integrity sha512-8KT2ZwlJyGwB/3BWzaJLZsBQ+lpq/ogpe/k6cEIrXgSqxMjWC7Hal/WWZhC9/FZNU5OUjDQuLYvhnH9hniOaiQ==
dependencies:
"@lumino/commands" "^1.12.0"
"@lumino/coreutils" "^1.5.3"
"@lumino/disposable" "^1.4.3"
"@lumino/properties" "^1.2.3"
"@lumino/signaling" "^1.4.3"

"@jupyterlab/statusbar@^3.0.9":
version "3.0.9"
resolved "https://registry.npmjs.org/@jupyterlab/statusbar/-/statusbar-3.0.9.tgz#b00d8b74e813bb9534e7a57d0419579e9367da7a"
Expand All @@ -763,6 +836,16 @@
react "^17.0.1"
typestyle "^2.0.4"

"@jupyterlab/translation@^3.0.0":
version "3.1.12"
resolved "https://registry.npmjs.org/@jupyterlab/translation/-/translation-3.1.12.tgz#9a44340525cb78d461a843d69f923a1557b71db0"
integrity sha512-/kqTX7gfmlZasRk1CFLGFutt2wrfdhXqpVxK0/wBqBKwYhv2pLRsQo51tcP+9jj4C5On8bPeRA1pLIuE7OKwwg==
dependencies:
"@jupyterlab/coreutils" "^5.1.12"
"@jupyterlab/services" "^6.1.12"
"@jupyterlab/statedb" "^3.1.12"
"@lumino/coreutils" "^1.5.3"

"@jupyterlab/translation@^3.0.9":
version "3.0.9"
resolved "https://registry.npmjs.org/@jupyterlab/translation/-/translation-3.0.9.tgz#54472d3d2fef0d56dfa61c2711a9155f3308ad5b"
Expand Down Expand Up @@ -9530,6 +9613,11 @@ ws@^7.2.0, ws@~7.4.2:
resolved "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==

ws@^7.4.6:
version "7.5.5"
resolved "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881"
integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==

xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
Expand Down

0 comments on commit 441135a

Please sign in to comment.