Skip to content

Commit 97d83fa

Browse files
author
Kartik Raj
committed
Localize group names
1 parent dfacb84 commit 97d83fa

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
"Interpreters.DiscoveringInterpreters": "Discovering Python Interpreters",
5454
"Interpreters.condaInheritEnvMessage": "We noticed you're using a conda environment. If you are experiencing issues with this environment in the integrated terminal, we recommend that you let the Python extension change \"terminal.integrated.inheritEnv\" to false in your user settings.",
5555
"Logging.CurrentWorkingDirectory": "cwd:",
56+
"InterpreterQuickPickList.workspaceGroupName": "Workspace",
57+
"InterpreterQuickPickList.globalGroupName": "Global",
5658
"InterpreterQuickPickList.quickPickListPlaceholder": "Current: {0}",
5759
"InterpreterQuickPickList.enterPath.label": "Enter interpreter path...",
5860
"InterpreterQuickPickList.enterPath.placeholder": "Enter path to a Python interpreter.",

src/client/common/utils/localize.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ export namespace Interpreters {
292292
}
293293

294294
export namespace InterpreterQuickPickList {
295+
export const globalGroupName = localize('InterpreterQuickPickList.globalGroupName', 'Global');
296+
export const workspaceGroupName = localize('InterpreterQuickPickList.workspaceGroupName', 'Workspace');
295297
export const quickPickListPlaceholder = localize(
296298
'InterpreterQuickPickList.quickPickListPlaceholder',
297299
'Current: {0}',

src/client/interpreter/configuration/interpreterSelector/commands/setInterpreter.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,18 @@ function isSeparatorItem(item: QuickPickType): item is QuickPickItem {
5151
return 'kind' in item && item.kind === QuickPickItemKind.Separator;
5252
}
5353

54-
export enum EnvGroups {
55-
Workspace = 'Workspace',
56-
Conda = 'Conda',
57-
Global = 'Global',
58-
VirtualEnv = 'VirtualEnv',
59-
PipEnv = 'PipEnv',
60-
Pyenv = 'Pyenv',
61-
Venv = 'Venv',
62-
Poetry = 'Poetry',
63-
VirtualEnvWrapper = 'VirtualEnvWrapper',
64-
Recommended = 'Recommended',
54+
// eslint-disable-next-line @typescript-eslint/no-namespace
55+
export namespace EnvGroups {
56+
export const Workspace = InterpreterQuickPickList.workspaceGroupName();
57+
export const Conda = 'Conda';
58+
export const Global = InterpreterQuickPickList.globalGroupName();
59+
export const VirtualEnv = 'VirtualEnv';
60+
export const PipEnv = 'PipEnv';
61+
export const Pyenv = 'Pyenv';
62+
export const Venv = 'Venv';
63+
export const Poetry = 'Poetry';
64+
export const VirtualEnvWrapper = 'VirtualEnvWrapper';
65+
export const Recommended = Common.recommended();
6566
}
6667
@injectable()
6768
export class SetInterpreterCommand extends BaseInterpreterSelectorCommand {
@@ -427,7 +428,7 @@ function getGroupedQuickPickItems(
427428
if (recommended) {
428429
updatedItems.push({ label: EnvGroups.Recommended, kind: QuickPickItemKind.Separator }, recommended);
429430
}
430-
let previousGroup: EnvGroups | undefined = EnvGroups.Recommended;
431+
let previousGroup = EnvGroups.Recommended;
431432
for (const item of items) {
432433
previousGroup = addSeparatorIfApplicable(updatedItems, item, workspacePath, previousGroup);
433434
updatedItems.push(item);
@@ -439,7 +440,7 @@ function addSeparatorIfApplicable(
439440
items: QuickPickType[],
440441
newItem: IInterpreterQuickPickItem,
441442
workspacePath?: string,
442-
previousGroup?: EnvGroups | undefined,
443+
previousGroup?: string | undefined,
443444
) {
444445
if (!previousGroup) {
445446
const lastItem = items.length ? items[items.length - 1] : undefined;

0 commit comments

Comments
 (0)