Skip to content

Commit 719a88f

Browse files
committed
feat: Localize Deepnote environment command titles and improve logging messages
Signed-off-by: Tomas Kislan <[email protected]>
1 parent b8b7f95 commit 719a88f

File tree

5 files changed

+41
-32
lines changed

5 files changed

+41
-32
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,54 +87,54 @@
8787
},
8888
{
8989
"command": "deepnote.environments.create",
90-
"title": "Create Environment",
90+
"title": "%deepnote.commands.environments.create.title%",
9191
"category": "Deepnote",
9292
"icon": "$(add)"
9393
},
9494
{
9595
"command": "deepnote.environments.start",
96-
"title": "Start Server",
96+
"title": "%deepnote.commands.environments.start.title%",
9797
"category": "Deepnote",
9898
"icon": "$(debug-start)"
9999
},
100100
{
101101
"command": "deepnote.environments.stop",
102-
"title": "Stop Server",
102+
"title": "%deepnote.commands.environments.stop.title%",
103103
"category": "Deepnote",
104104
"icon": "$(debug-stop)"
105105
},
106106
{
107107
"command": "deepnote.environments.restart",
108-
"title": "Restart Server",
108+
"title": "%deepnote.commands.environments.restart.title%",
109109
"category": "Deepnote",
110110
"icon": "$(debug-restart)"
111111
},
112112
{
113113
"command": "deepnote.environments.delete",
114-
"title": "Delete Environment",
114+
"title": "%deepnote.commands.environments.delete.title%",
115115
"category": "Deepnote",
116116
"icon": "$(trash)"
117117
},
118118
{
119119
"command": "deepnote.environments.managePackages",
120-
"title": "Manage Packages",
120+
"title": "%deepnote.commands.environments.managePackages.title%",
121121
"category": "Deepnote",
122122
"icon": "$(package)"
123123
},
124124
{
125125
"command": "deepnote.environments.editName",
126-
"title": "Rename Environment",
126+
"title": "%deepnote.commands.environments.editName.title%",
127127
"category": "Deepnote"
128128
},
129129
{
130130
"command": "deepnote.environments.refresh",
131-
"title": "Refresh",
131+
"title": "%deepnote.commands.environments.refresh.title%",
132132
"category": "Deepnote",
133133
"icon": "$(refresh)"
134134
},
135135
{
136136
"command": "deepnote.environments.selectForNotebook",
137-
"title": "Select Environment for Notebook",
137+
"title": "%deepnote.commands.environments.selectForNotebook.title%",
138138
"category": "Deepnote",
139139
"icon": "$(server-environment)"
140140
},

package.nls.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,5 +255,14 @@
255255
"deepnote.commands.importJupyterNotebook.title": "Import Jupyter Notebook",
256256
"deepnote.views.explorer.name": "Explorer",
257257
"deepnote.views.explorer.welcome": "No Deepnote notebooks found in this workspace.",
258-
"deepnote.command.selectNotebook.title": "Select Notebook"
258+
"deepnote.command.selectNotebook.title": "Select Notebook",
259+
"deepnote.commands.environments.create.title": "Create Environment",
260+
"deepnote.commands.environments.start.title": "Start Server",
261+
"deepnote.commands.environments.stop.title": "Stop Server",
262+
"deepnote.commands.environments.restart.title": "Restart Server",
263+
"deepnote.commands.environments.delete.title": "Delete Environment",
264+
"deepnote.commands.environments.managePackages.title": "Manage Packages",
265+
"deepnote.commands.environments.editName.title": "Rename Environment",
266+
"deepnote.commands.environments.refresh.title": "Refresh",
267+
"deepnote.commands.environments.selectForNotebook.title": "Select Environment for Notebook"
259268
}

src/kernels/deepnote/deepnoteServerStarter.node.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
import { inject, injectable, named, optional } from 'inversify';
5-
import { CancellationToken, Uri } from 'vscode';
5+
import { CancellationToken, l10n, Uri } from 'vscode';
66
import { PythonEnvironment } from '../../platform/pythonEnvironments/info';
77
import { IDeepnoteServerStarter, IDeepnoteToolkitInstaller, DeepnoteServerInfo, DEEPNOTE_DEFAULT_PORT } from './types';
88
import { IProcessServiceFactory, ObservableExecutionResult } from '../../platform/common/process/types.node';
@@ -182,7 +182,7 @@ export class DeepnoteServerStarter implements IDeepnoteServerStarter, IExtension
182182
`Starting deepnote-toolkit server on jupyter port ${jupyterPort} and lsp port ${lspPort} for environment ${environmentId}`
183183
);
184184
this.outputChannel.appendLine(
185-
`Starting Deepnote server on jupyter port ${jupyterPort} and lsp port ${lspPort}...`
185+
l10n.t('Starting Deepnote server on jupyter port {0} and lsp port {1}...', jupyterPort, lspPort)
186186
);
187187

188188
// Start the server with venv's Python in PATH
@@ -329,7 +329,7 @@ export class DeepnoteServerStarter implements IDeepnoteServerStarter, IExtension
329329
}
330330

331331
logger.info(`Deepnote server started successfully at ${url} for environment ${environmentId}`);
332-
this.outputChannel.appendLine(`✓ Deepnote server running at ${url}`);
332+
this.outputChannel.appendLine(l10n.t('✓ Deepnote server running at {0}', url));
333333

334334
return serverInfo;
335335
}
@@ -349,7 +349,7 @@ export class DeepnoteServerStarter implements IDeepnoteServerStarter, IExtension
349349
this.serverProcesses.delete(environmentId);
350350
this.serverInfos.delete(environmentId);
351351
this.serverOutputByFile.delete(environmentId);
352-
this.outputChannel.appendLine(`Deepnote server stopped for environment ${environmentId}`);
352+
this.outputChannel.appendLine(l10n.t('Deepnote server stopped for environment {0}', environmentId));
353353

354354
// Clean up lock file after stopping the server
355355
if (serverPid) {
@@ -837,7 +837,7 @@ export class DeepnoteServerStarter implements IDeepnoteServerStarter, IExtension
837837
if (pidsToKill.length > 0) {
838838
logger.info(`Killing ${pidsToKill.length} orphaned process(es): ${pidsToKill.join(', ')}`);
839839
this.outputChannel.appendLine(
840-
`Cleaning up ${pidsToKill.length} orphaned deepnote-toolkit process(es)...`
840+
l10n.t('Cleaning up {0} orphaned deepnote-toolkit process(es)...', pidsToKill.length)
841841
);
842842

843843
for (const pid of pidsToKill) {
@@ -858,7 +858,7 @@ export class DeepnoteServerStarter implements IDeepnoteServerStarter, IExtension
858858
}
859859
}
860860

861-
this.outputChannel.appendLine('✓ Cleanup complete');
861+
this.outputChannel.appendLine(l10n.t('✓ Cleanup complete'));
862862
} else {
863863
logger.info('No orphaned deepnote-toolkit processes found (all processes are active)');
864864
}

src/kernels/deepnote/deepnoteSharedToolkitInstaller.node.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
import { inject, injectable, named } from 'inversify';
5-
import { CancellationToken, Uri } from 'vscode';
5+
import { CancellationToken, l10n, Uri } from 'vscode';
66
import { PythonEnvironment } from '../../platform/pythonEnvironments/info';
77
import { IProcessServiceFactory } from '../../platform/common/process/types.node';
88
import { logger } from '../../platform/logging';
@@ -198,7 +198,7 @@ export class DeepnoteSharedToolkitInstaller {
198198
logger.info(
199199
`Installing shared deepnote-toolkit v${this.toolkitVersion} to ${this.sharedInstallationPath.fsPath}`
200200
);
201-
this.outputChannel.appendLine(`Installing shared deepnote-toolkit v${this.toolkitVersion}...`);
201+
this.outputChannel.appendLine(l10n.t('Installing shared deepnote-toolkit v{0}...', this.toolkitVersion));
202202

203203
// Create shared installation directory
204204
await this.fs.createDirectory(this.sharedInstallationPath);
@@ -240,16 +240,16 @@ export class DeepnoteSharedToolkitInstaller {
240240
await this.fs.writeFile(this.versionFilePath, Buffer.from(this.toolkitVersion, 'utf8'));
241241

242242
logger.info(`Shared deepnote-toolkit v${this.toolkitVersion} installed successfully`);
243-
this.outputChannel.appendLine(`✓ Shared deepnote-toolkit v${this.toolkitVersion} ready`);
243+
this.outputChannel.appendLine(l10n.t('✓ Shared deepnote-toolkit v{0} ready', this.toolkitVersion));
244244
return true;
245245
} else {
246246
logger.error('Shared deepnote-toolkit installation failed - package not found');
247-
this.outputChannel.appendLine('✗ Shared deepnote-toolkit installation failed');
247+
this.outputChannel.appendLine(l10n.t('✗ Shared deepnote-toolkit installation failed'));
248248
return false;
249249
}
250250
} catch (ex) {
251251
logger.error(`Failed to install shared deepnote-toolkit: ${ex}`);
252-
this.outputChannel.appendLine(`Error installing shared deepnote-toolkit: ${ex}`);
252+
this.outputChannel.appendLine(l10n.t('Error installing shared deepnote-toolkit: {0}', ex));
253253
return false;
254254
}
255255
}

src/kernels/deepnote/deepnoteToolkitInstaller.node.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Licensed under the MIT License.
33

44
import { inject, injectable, named } from 'inversify';
5-
import { CancellationToken, Uri, workspace } from 'vscode';
5+
import { CancellationToken, l10n, Uri, workspace } from 'vscode';
66
import { Cancellation } from '../../platform/common/cancellation';
77
import { STANDARD_OUTPUT_CHANNEL } from '../../platform/common/constants';
88
import { IFileSystem } from '../../platform/common/platform/types';
@@ -166,7 +166,7 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
166166
}
167167

168168
logger.info(`Installing additional packages in ${venvPath.fsPath}: ${packages.join(', ')}`);
169-
this.outputChannel.appendLine(`Installing packages: ${packages.join(', ')}...`);
169+
this.outputChannel.appendLine(l10n.t('Installing packages: {0}...', packages.join(', ')));
170170

171171
try {
172172
Cancellation.throwIfCanceled(token);
@@ -186,10 +186,10 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
186186
}
187187

188188
logger.info('Additional packages installed successfully');
189-
this.outputChannel.appendLine('✓ Packages installed successfully');
189+
this.outputChannel.appendLine(l10n.t('✓ Packages installed successfully'));
190190
} catch (ex) {
191191
logger.error(`Failed to install additional packages: ${ex}`);
192-
this.outputChannel.appendLine(`✗ Failed to install packages: ${ex}`);
192+
this.outputChannel.appendLine(l10n.t('✗ Failed to install packages: {0}', ex));
193193
throw ex;
194194
}
195195
}
@@ -206,7 +206,7 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
206206
Cancellation.throwIfCanceled(token);
207207

208208
logger.info(`Creating virtual environment at ${venvPath.fsPath}`);
209-
this.outputChannel.appendLine(`Setting up Deepnote toolkit environment...`);
209+
this.outputChannel.appendLine(l10n.t('Setting up Deepnote toolkit environment...'));
210210

211211
// Create venv parent directory if it doesn't exist
212212
const venvParentDir = Uri.joinPath(this.context.globalStorageUri, 'deepnote-venvs');
@@ -239,7 +239,7 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
239239
if (venvResult.stderr) {
240240
logger.error(`venv stderr: ${venvResult.stderr}`);
241241
}
242-
this.outputChannel.appendLine('Error: Failed to create virtual environment');
242+
this.outputChannel.appendLine(l10n.t('Error: Failed to create virtual environment'));
243243

244244
throw new DeepnoteVenvCreationError(
245245
baseInterpreter.uri.fsPath,
@@ -253,7 +253,7 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
253253

254254
// Upgrade pip in the venv to the latest version
255255
logger.info('Upgrading pip in venv to latest version...');
256-
this.outputChannel.appendLine('Upgrading pip...');
256+
this.outputChannel.appendLine(l10n.t('Upgrading pip...'));
257257
const pipUpgradeResult = await venvProcessService.exec(
258258
venvInterpreter.uri.fsPath,
259259
['-m', 'pip', 'install', '--upgrade', 'pip'],
@@ -271,7 +271,7 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
271271

272272
// Install deepnote-toolkit and ipykernel in venv
273273
logger.info(`Installing deepnote-toolkit and ipykernel in venv from ${DEEPNOTE_TOOLKIT_WHEEL_URL}`);
274-
this.outputChannel.appendLine('Installing deepnote-toolkit and ipykernel...');
274+
this.outputChannel.appendLine(l10n.t('Installing deepnote-toolkit and ipykernel...'));
275275

276276
const installResult = await venvProcessService.exec(
277277
venvInterpreter.uri.fsPath,
@@ -308,11 +308,11 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
308308
// Don't fail the entire installation if kernel spec creation fails
309309
}
310310

311-
this.outputChannel.appendLine('✓ Deepnote toolkit ready');
311+
this.outputChannel.appendLine(l10n.t('✓ Deepnote toolkit ready'));
312312
return { pythonInterpreter: venvInterpreter, toolkitVersion: installedToolkitVersion };
313313
} else {
314314
logger.error('deepnote-toolkit installation failed');
315-
this.outputChannel.appendLine('✗ deepnote-toolkit installation failed');
315+
this.outputChannel.appendLine(l10n.t('✗ deepnote-toolkit installation failed'));
316316

317317
throw new DeepnoteToolkitInstallError(
318318
venvInterpreter.uri.fsPath,
@@ -330,7 +330,7 @@ export class DeepnoteToolkitInstaller implements IDeepnoteToolkitInstaller {
330330

331331
// Otherwise, log full details and wrap in a generic toolkit install error
332332
logger.error(`Failed to set up deepnote-toolkit: ${ex}`);
333-
this.outputChannel.appendLine('Failed to set up deepnote-toolkit; see logs for details');
333+
this.outputChannel.appendLine(l10n.t('Failed to set up deepnote-toolkit; see logs for details'));
334334

335335
throw new DeepnoteToolkitInstallError(
336336
baseInterpreter.uri.fsPath,

0 commit comments

Comments
 (0)