@@ -8,6 +8,7 @@ import { IDocumentManager } from '@jupyterlab/docmanager';
8
8
import { ServerConnection } from '@jupyterlab/services' ;
9
9
import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
10
10
import { FileBrowser , IDefaultFileBrowser } from '@jupyterlab/filebrowser' ;
11
+ import { ITranslator , nullTranslator } from '@jupyterlab/translation' ;
11
12
import { CommandRegistry } from '@lumino/commands' ;
12
13
import { ReadonlyPartialJSONObject } from '@lumino/coreutils' ;
13
14
import { Message } from '@lumino/messaging' ;
@@ -128,20 +129,17 @@ class QuickOpenWidget extends CommandPalette {
128
129
const extension : JupyterFrontEndPlugin < void > = {
129
130
id : 'jupyterlab-quickopen:plugin' ,
130
131
autoStart : true ,
131
- requires : [
132
- ICommandPalette ,
133
- IDocumentManager ,
134
- ISettingRegistry ,
135
- IDefaultFileBrowser
136
- ] ,
132
+ requires : [ IDocumentManager , ISettingRegistry , IDefaultFileBrowser ] ,
133
+ optional : [ ICommandPalette , ITranslator ] ,
137
134
activate : async (
138
135
app : JupyterFrontEnd ,
139
- palette : ICommandPalette ,
140
136
docManager : IDocumentManager ,
141
137
settingRegistry : ISettingRegistry ,
142
- defaultFileBrowser : IDefaultFileBrowser
138
+ defaultFileBrowser : IDefaultFileBrowser ,
139
+ palette : ICommandPalette | null ,
140
+ translator : ITranslator | null
143
141
) => {
144
- console . log ( `Activated extension: ${ extension . id } ` ) ;
142
+ const trans = ( translator ?? nullTranslator ) . load ( 'jupyterlab-quickopen' ) ;
145
143
const commands : CommandRegistry = new CommandRegistry ( ) ;
146
144
const settings : ISettingRegistry . ISettings = await settingRegistry . load (
147
145
extension . id
@@ -173,12 +171,14 @@ const extension: JupyterFrontEndPlugin<void> = {
173
171
// palette, assign a hotkey, etc.
174
172
const command = 'quickopen:activate' ;
175
173
app . commands . addCommand ( command , {
176
- label : 'Quick Open' ,
174
+ label : trans . __ ( 'Quick Open' ) ,
177
175
execute : ( ) => {
178
176
modalPalette . activate ( ) ;
179
177
}
180
178
} ) ;
181
- palette . addItem ( { command, category : 'File Operations' } ) ;
179
+ if ( palette ) {
180
+ palette . addItem ( { command, category : 'File Operations' } ) ;
181
+ }
182
182
}
183
183
} ;
184
184
0 commit comments