Skip to content

Commit

Permalink
Localize group names
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed Jan 13, 2022
1 parent dfacb84 commit 97d83fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
"Interpreters.DiscoveringInterpreters": "Discovering Python Interpreters",
"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.",
"Logging.CurrentWorkingDirectory": "cwd:",
"InterpreterQuickPickList.workspaceGroupName": "Workspace",
"InterpreterQuickPickList.globalGroupName": "Global",
"InterpreterQuickPickList.quickPickListPlaceholder": "Current: {0}",
"InterpreterQuickPickList.enterPath.label": "Enter interpreter path...",
"InterpreterQuickPickList.enterPath.placeholder": "Enter path to a Python interpreter.",
Expand Down
2 changes: 2 additions & 0 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ export namespace Interpreters {
}

export namespace InterpreterQuickPickList {
export const globalGroupName = localize('InterpreterQuickPickList.globalGroupName', 'Global');
export const workspaceGroupName = localize('InterpreterQuickPickList.workspaceGroupName', 'Workspace');
export const quickPickListPlaceholder = localize(
'InterpreterQuickPickList.quickPickListPlaceholder',
'Current: {0}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ function isSeparatorItem(item: QuickPickType): item is QuickPickItem {
return 'kind' in item && item.kind === QuickPickItemKind.Separator;
}

export enum EnvGroups {
Workspace = 'Workspace',
Conda = 'Conda',
Global = 'Global',
VirtualEnv = 'VirtualEnv',
PipEnv = 'PipEnv',
Pyenv = 'Pyenv',
Venv = 'Venv',
Poetry = 'Poetry',
VirtualEnvWrapper = 'VirtualEnvWrapper',
Recommended = 'Recommended',
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace EnvGroups {
export const Workspace = InterpreterQuickPickList.workspaceGroupName();
export const Conda = 'Conda';
export const Global = InterpreterQuickPickList.globalGroupName();
export const VirtualEnv = 'VirtualEnv';
export const PipEnv = 'PipEnv';
export const Pyenv = 'Pyenv';
export const Venv = 'Venv';
export const Poetry = 'Poetry';
export const VirtualEnvWrapper = 'VirtualEnvWrapper';
export const Recommended = Common.recommended();
}
@injectable()
export class SetInterpreterCommand extends BaseInterpreterSelectorCommand {
Expand Down Expand Up @@ -427,7 +428,7 @@ function getGroupedQuickPickItems(
if (recommended) {
updatedItems.push({ label: EnvGroups.Recommended, kind: QuickPickItemKind.Separator }, recommended);
}
let previousGroup: EnvGroups | undefined = EnvGroups.Recommended;
let previousGroup = EnvGroups.Recommended;
for (const item of items) {
previousGroup = addSeparatorIfApplicable(updatedItems, item, workspacePath, previousGroup);
updatedItems.push(item);
Expand All @@ -439,7 +440,7 @@ function addSeparatorIfApplicable(
items: QuickPickType[],
newItem: IInterpreterQuickPickItem,
workspacePath?: string,
previousGroup?: EnvGroups | undefined,
previousGroup?: string | undefined,
) {
if (!previousGroup) {
const lastItem = items.length ? items[items.length - 1] : undefined;
Expand Down

0 comments on commit 97d83fa

Please sign in to comment.