Skip to content

[Bug][i18n][Conda] Named environment flow skips the name prompt in zh-CN because a localized label is compared with "Named" #2389

Description

@Sun-hongbo

Description

When the VS Code display language is Simplified Chinese (zh-cn), the Python Environments extension cannot correctly create a named Conda environment through the graphical environment creation flow.

After selecting:

  1. Conda
  2. “已命名” (Named)
  3. A Python version

the environment-name input box does not appear, and no conda create --name ... command is executed.

Creating a prefix-based Conda environment through the same graphical interface works correctly. Conda itself also works correctly from the terminal.

Environment

  • OS: Windows x64
  • VS Code: 1.136.0
  • Display language: Simplified Chinese (zh-cn)
  • Python Environments extension: 1.36.0
  • Python extension: 2026.4.0
  • Pylance: 2026.3.1
  • Conda: 26.7.1
  • Distribution: Miniconda
  • Base Python: 3.14.7
  • Environment manager: Conda

Relevant settings:

{
    "python-envs.defaultEnvManager": "ms-python.python:conda",
    "python-envs.defaultPackageManager": "ms-python.python:conda"
}

Steps to reproduce

  1. Set the VS Code display language to Simplified Chinese.
  2. Reload VS Code.
  3. Open a folder or workspace.
  4. Run the Python environment creation command from the Command Palette or Python Environments view.
  5. Select Conda.
  6. Select 已命名 (Named).
  7. Select Python 3.14, or another available Python version.
  8. Observe that the environment-name input box is not displayed.

Actual behavior

The wizard does not proceed to the environment-name input step. In the observed run, no named-environment creation command was sent to Conda.

The prefix-based flow works correctly.

Expected behavior

After selecting 已命名 and a Python version, the wizard should display an input box for the Conda environment name and then execute the equivalent of:

conda create --name <environment-name> python=<version>

Suspected root cause

In src/managers/conda/condaStepBasedFlow.ts, the selected localized UI label is stored directly in state.envType:

state.envType = selection.label;

In the Simplified Chinese locale, CondaStrings.condaNamed is translated as:

已命名

However, the next step compares that localized value with a hard-coded English string:

return state.envType === 'Named'
    ? enterEnvironmentName
    : selectLocation;

Therefore, under zh-cn, the effective comparison is:

'已命名' === 'Named'

which is always false. The wizard incorrectly enters the prefix/location branch instead of the named-environment branch.

There is another related hard-coded assignment in the multi-folder path:

state.envType = 'Named';

Later logic compares state.envType with CondaStrings.condaNamed, creating the inverse localization inconsistency.

Source file:

https://github.com/microsoft/vscode-python-environments/blob/main/src/managers/conda/condaStepBasedFlow.ts

Suggested fix

As a minimal fix, use the same localized constant consistently:

return state.envType === CondaStrings.condaNamed
    ? enterEnvironmentName
    : selectLocation;

The multi-folder assignment should also be made consistent:

state.envType = CondaStrings.condaNamed;

A more robust solution would be to avoid using localized display labels as internal state. For example:

type CondaEnvironmentType = 'named' | 'prefix';

const items = [
    {
        label: CondaStrings.condaNamed,
        envType: 'named' as const,
    },
    {
        label: CondaStrings.condaPrefix,
        envType: 'prefix' as const,
    },
];

state.envType = selection.envType;

return state.envType === 'named'
    ? enterEnvironmentName
    : selectLocation;

This would prevent the control flow from depending on the current display language.

Additional diagnostics

  • Conda is detected successfully.
  • The base Conda environment is detected successfully.
  • Creating a prefix-based environment from the GUI succeeds.
  • Creating or resolving an environment through the Conda CLI succeeds.
  • The issue occurs before conda create is invoked.
  • Reloading the VS Code window does not resolve the issue.
  • Reconfiguring the default environment and package managers does not resolve it.
  • The problem appears to be isolated to the localized named-environment wizard branch.

Workarounds

Possible temporary workarounds are:

  1. Change the VS Code display language to English while creating the named environment.

  2. Create the environment from the terminal:

    conda create --name <environment-name> python=3.14
  3. Use a prefix-based Conda environment.

  4. Locally patch the bundled extension so the comparison uses CondaStrings.condaNamed.

The local patch may be overwritten when the extension is updated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions