Skip to content

Commit 441135a

Browse files
authored
Merge pull request #3286 from jtpio/translator
Add support for localization to the lab extension
2 parents 3558ce6 + da7d7ad commit 441135a

File tree

3 files changed

+101
-3
lines changed

3 files changed

+101
-3
lines changed

jupyterlab_widgets/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"@jupyterlab/rendermime-interfaces": "^3.0.0",
6464
"@jupyterlab/services": "^6.0.0",
6565
"@jupyterlab/settingregistry": "^3.0.0",
66+
"@jupyterlab/translation": "^3.0.0",
6667
"@lumino/algorithm": "^1.1.0",
6768
"@lumino/coreutils": "^1.3.0",
6869
"@lumino/disposable": "^1.1.1",

jupyterlab_widgets/src/plugin.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { JUPYTER_CONTROLS_VERSION } from '@jupyter-widgets/controls/lib/version'
4747
import '@jupyter-widgets/base/css/index.css';
4848
import '@jupyter-widgets/controls/css/widgets-base.css';
4949
import { KernelMessage } from '@jupyterlab/services';
50+
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
5051

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

@@ -146,7 +147,13 @@ export function registerWidgetManager(
146147
const plugin: JupyterFrontEndPlugin<base.IJupyterWidgetRegistry> = {
147148
id: '@jupyter-widgets/jupyterlab-manager:plugin',
148149
requires: [IRenderMimeRegistry],
149-
optional: [INotebookTracker, ISettingRegistry, IMainMenu, ILoggerRegistry],
150+
optional: [
151+
INotebookTracker,
152+
ISettingRegistry,
153+
IMainMenu,
154+
ILoggerRegistry,
155+
ITranslator,
156+
],
150157
provides: base.IJupyterWidgetRegistry,
151158
activate: activateWidgetExtension,
152159
autoStart: true,
@@ -167,9 +174,11 @@ function activateWidgetExtension(
167174
tracker: INotebookTracker | null,
168175
settingRegistry: ISettingRegistry | null,
169176
menu: IMainMenu | null,
170-
loggerRegistry: ILoggerRegistry | null
177+
loggerRegistry: ILoggerRegistry | null,
178+
translator: ITranslator | null
171179
): base.IJupyterWidgetRegistry {
172180
const { commands } = app;
181+
const trans = (translator ?? nullTranslator).load('jupyterlab_widgets');
173182

174183
const bindUnhandledIOPubMessageSignal = (nb: NotebookPanel): void => {
175184
if (!loggerRegistry) {
@@ -250,7 +259,7 @@ function activateWidgetExtension(
250259
if (settingRegistry !== null) {
251260
// Add a command for automatically saving (jupyter-)widget state.
252261
commands.addCommand('@jupyter-widgets/jupyterlab-manager:saveWidgetState', {
253-
label: 'Save Widget State Automatically',
262+
label: trans.__('Save Widget State Automatically'),
254263
execute: (args) => {
255264
return settingRegistry
256265
.set(plugin.id, 'saveState', !SETTINGS.saveState)

yarn.lock

+88
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,19 @@
505505
path-browserify "^1.0.0"
506506
url-parse "~1.5.1"
507507

508+
"@jupyterlab/coreutils@^5.1.12":
509+
version "5.1.12"
510+
resolved "https://registry.npmjs.org/@jupyterlab/coreutils/-/coreutils-5.1.12.tgz#eb08aa4bf68912b6188d16bce402e737dedccd84"
511+
integrity sha512-gZHFekV8XdP4naH+5q7l6v8TVsUgJk16OpgLLCdOOGuwFOW7zduBe1td6Z820brsmnqb1kg2jBcxl0RwVw7tLQ==
512+
dependencies:
513+
"@lumino/coreutils" "^1.5.3"
514+
"@lumino/disposable" "^1.4.3"
515+
"@lumino/signaling" "^1.4.3"
516+
minimist "~1.2.0"
517+
moment "^2.24.0"
518+
path-browserify "^1.0.0"
519+
url-parse "~1.5.1"
520+
508521
"@jupyterlab/docmanager@^3.0.11":
509522
version "3.0.11"
510523
resolved "https://registry.npmjs.org/@jupyterlab/docmanager/-/docmanager-3.0.11.tgz#dd30f93a9590369812f986198fc4c70f8452d8ca"
@@ -611,6 +624,13 @@
611624
dependencies:
612625
"@lumino/coreutils" "^1.5.3"
613626

627+
"@jupyterlab/nbformat@^3.1.12":
628+
version "3.1.12"
629+
resolved "https://registry.npmjs.org/@jupyterlab/nbformat/-/nbformat-3.1.12.tgz#96effa28062f49cd8543d78929d6106ad6e76b3d"
630+
integrity sha512-/c9MiQRMg/C7GQMmK4hRJkeE3+48HlC7ipVTUl4mXhEkWq+9v7loKwT6CzGAoxQrpdTf0/+NiCxF1TqYFoJxPQ==
631+
dependencies:
632+
"@lumino/coreutils" "^1.5.3"
633+
614634
"@jupyterlab/notebook@^3.0.0":
615635
version "3.0.11"
616636
resolved "https://registry.npmjs.org/@jupyterlab/notebook/-/notebook-3.0.11.tgz#2fc2adbea1133e16554f99bfb3f0ae81bbf8ac91"
@@ -650,6 +670,17 @@
650670
"@lumino/messaging" "^1.4.3"
651671
"@lumino/signaling" "^1.4.3"
652672

673+
"@jupyterlab/observables@^4.1.12":
674+
version "4.1.12"
675+
resolved "https://registry.npmjs.org/@jupyterlab/observables/-/observables-4.1.12.tgz#62c5484755b0d15a0bf5d323893397900ebe8508"
676+
integrity sha512-mfkV7USTedOGx8LrCYfZ/1DnZ8Gm9BXLtqbBcU/PETIZnFtqrWKMdC0W4n0jxMiiyVTuPNntePftC3m1fm+u5w==
677+
dependencies:
678+
"@lumino/algorithm" "^1.3.3"
679+
"@lumino/coreutils" "^1.5.3"
680+
"@lumino/disposable" "^1.4.3"
681+
"@lumino/messaging" "^1.4.3"
682+
"@lumino/signaling" "^1.4.3"
683+
653684
"@jupyterlab/outputarea@^3.0.0", "@jupyterlab/outputarea@^3.0.10":
654685
version "3.0.10"
655686
resolved "https://registry.npmjs.org/@jupyterlab/outputarea/-/outputarea-3.0.10.tgz#3e04a0fffd0175eca60ea7781a3b70a924d8779f"
@@ -718,6 +749,24 @@
718749
node-fetch "^2.6.0"
719750
ws "^7.2.0"
720751

752+
"@jupyterlab/services@^6.1.12":
753+
version "6.1.12"
754+
resolved "https://registry.npmjs.org/@jupyterlab/services/-/services-6.1.12.tgz#b2ddb169579ef3688e4ec428074e1bc2bf1bbbfa"
755+
integrity sha512-0I7tHcT9rOqnD3+YUSBz9RWuOSIGAyAsa3dJpZZ6hHzTxx/H8mkGMVFan3/gL7XWScCMlTkTd4GBNwoo/unV0A==
756+
dependencies:
757+
"@jupyterlab/coreutils" "^5.1.12"
758+
"@jupyterlab/nbformat" "^3.1.12"
759+
"@jupyterlab/observables" "^4.1.12"
760+
"@jupyterlab/settingregistry" "^3.1.12"
761+
"@jupyterlab/statedb" "^3.1.12"
762+
"@lumino/algorithm" "^1.3.3"
763+
"@lumino/coreutils" "^1.5.3"
764+
"@lumino/disposable" "^1.4.3"
765+
"@lumino/polling" "^1.3.3"
766+
"@lumino/signaling" "^1.4.3"
767+
node-fetch "^2.6.0"
768+
ws "^7.4.6"
769+
721770
"@jupyterlab/settingregistry@^3.0.0", "@jupyterlab/settingregistry@^3.0.6":
722771
version "3.0.6"
723772
resolved "https://registry.npmjs.org/@jupyterlab/settingregistry/-/settingregistry-3.0.6.tgz#000cd9dc4984a1ccac01d73c7967893befe14b8d"
@@ -731,6 +780,19 @@
731780
ajv "^6.12.3"
732781
json5 "^2.1.1"
733782

783+
"@jupyterlab/settingregistry@^3.1.12":
784+
version "3.1.12"
785+
resolved "https://registry.npmjs.org/@jupyterlab/settingregistry/-/settingregistry-3.1.12.tgz#a6a1f1ae3fa90022363d9c3b874b2089895f5d5d"
786+
integrity sha512-cwqBoE4S2n5F/Qbwz2o6sDAeRh/lcgGdualyJfPAHOJruloHrLzQLrwdN8duq411s99p34T4PixoLKQqTIdb5A==
787+
dependencies:
788+
"@jupyterlab/statedb" "^3.1.12"
789+
"@lumino/commands" "^1.12.0"
790+
"@lumino/coreutils" "^1.5.3"
791+
"@lumino/disposable" "^1.4.3"
792+
"@lumino/signaling" "^1.4.3"
793+
ajv "^6.12.3"
794+
json5 "^2.1.1"
795+
734796
"@jupyterlab/statedb@^3.0.6":
735797
version "3.0.6"
736798
resolved "https://registry.npmjs.org/@jupyterlab/statedb/-/statedb-3.0.6.tgz#d331c815496f80083d53277e1972095da954f31f"
@@ -742,6 +804,17 @@
742804
"@lumino/properties" "^1.2.3"
743805
"@lumino/signaling" "^1.4.3"
744806

807+
"@jupyterlab/statedb@^3.1.12":
808+
version "3.1.12"
809+
resolved "https://registry.npmjs.org/@jupyterlab/statedb/-/statedb-3.1.12.tgz#46852261fec2c0a35da80d39b938a12c1fbe1225"
810+
integrity sha512-8KT2ZwlJyGwB/3BWzaJLZsBQ+lpq/ogpe/k6cEIrXgSqxMjWC7Hal/WWZhC9/FZNU5OUjDQuLYvhnH9hniOaiQ==
811+
dependencies:
812+
"@lumino/commands" "^1.12.0"
813+
"@lumino/coreutils" "^1.5.3"
814+
"@lumino/disposable" "^1.4.3"
815+
"@lumino/properties" "^1.2.3"
816+
"@lumino/signaling" "^1.4.3"
817+
745818
"@jupyterlab/statusbar@^3.0.9":
746819
version "3.0.9"
747820
resolved "https://registry.npmjs.org/@jupyterlab/statusbar/-/statusbar-3.0.9.tgz#b00d8b74e813bb9534e7a57d0419579e9367da7a"
@@ -763,6 +836,16 @@
763836
react "^17.0.1"
764837
typestyle "^2.0.4"
765838

839+
"@jupyterlab/translation@^3.0.0":
840+
version "3.1.12"
841+
resolved "https://registry.npmjs.org/@jupyterlab/translation/-/translation-3.1.12.tgz#9a44340525cb78d461a843d69f923a1557b71db0"
842+
integrity sha512-/kqTX7gfmlZasRk1CFLGFutt2wrfdhXqpVxK0/wBqBKwYhv2pLRsQo51tcP+9jj4C5On8bPeRA1pLIuE7OKwwg==
843+
dependencies:
844+
"@jupyterlab/coreutils" "^5.1.12"
845+
"@jupyterlab/services" "^6.1.12"
846+
"@jupyterlab/statedb" "^3.1.12"
847+
"@lumino/coreutils" "^1.5.3"
848+
766849
"@jupyterlab/translation@^3.0.9":
767850
version "3.0.9"
768851
resolved "https://registry.npmjs.org/@jupyterlab/translation/-/translation-3.0.9.tgz#54472d3d2fef0d56dfa61c2711a9155f3308ad5b"
@@ -9530,6 +9613,11 @@ ws@^7.2.0, ws@~7.4.2:
95309613
resolved "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c"
95319614
integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==
95329615

9616+
ws@^7.4.6:
9617+
version "7.5.5"
9618+
resolved "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881"
9619+
integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==
9620+
95339621
xtend@~4.0.1:
95349622
version "4.0.2"
95359623
resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"

0 commit comments

Comments
 (0)