mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Move all messages from the dialogs for creating venv and Conda environments to PyBundle
This commit is contained in:
@@ -904,6 +904,26 @@ sdk.paths.dialog.reload.paths=Reload list of paths
|
||||
sdk.paths.dialog.added.by.user.suffix=(added by user)
|
||||
sdk.paths.dialog.removed.by.user.suffix=(removed by user)
|
||||
|
||||
sdk.create.venv.dialog.creating.venv=Creating virtual environment
|
||||
sdk.create.venv.dialog.make.available.to.all.projects=Make available to all projects
|
||||
sdk.create.venv.dialog.select.venv.location=Select Location for Virtual Environment
|
||||
sdk.create.venv.dialog.error.not.empty.directory=Directory is not empty
|
||||
sdk.create.venv.dialog.error.empty.venv.name=VirtualEnv name can't be empty
|
||||
sdk.create.venv.dialog.error.empty.venv.location=Destination directory path can't be empty
|
||||
sdk.create.venv.dialog.error.invalid.directory.name=Invalid directory name
|
||||
sdk.create.venv.dialog.error.failed.to.create.venv=Failed to Create Virtual Environment
|
||||
|
||||
sdk.create.venv.dialog.title=Create Virtual Environment
|
||||
sdk.create.venv.dialog.label.name=Name:
|
||||
sdk.create.venv.dialog.label.location=Location:
|
||||
sdk.create.venv.dialog.label.base.interpreter=Base interpreter:
|
||||
sdk.create.venv.dialog.label.inherit.global.site.packages=Inherit global site-packages
|
||||
sdk.create.venv.dialog.error.no.base.interpreter=Select base interpreter
|
||||
|
||||
sdk.create.venv.conda.dialog.title=Create Conda Environment
|
||||
sdk.create.venv.conda.dialog.error.no.python.version=Select python version
|
||||
sdk.create.venv.conda.dialog.label.python.version=Python version:
|
||||
|
||||
# remote interpreters
|
||||
remote.interpreter.add.title=Add Remote Interpreter
|
||||
remote.interpreter.configure.title=Configure Remote Python Interpreter
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.webcore.packaging.PackageManagementService;
|
||||
import com.intellij.webcore.packaging.PackagesNotificationPanel;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.packaging.PyPackageService;
|
||||
import com.jetbrains.python.packaging.ui.PyPackageManagementService;
|
||||
import com.jetbrains.python.sdk.flavors.VirtualEnvSdkFlavor;
|
||||
@@ -104,7 +105,7 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
|
||||
myMainPanel = new JPanel(layout);
|
||||
myName = new JTextField();
|
||||
myDestination = new TextFieldWithBrowseButton();
|
||||
myMakeAvailableToAllProjectsCheckbox = new JBCheckBox("Make available to all projects");
|
||||
myMakeAvailableToAllProjectsCheckbox = new JBCheckBox(PyBundle.message("sdk.create.venv.dialog.make.available.to.all.projects"));
|
||||
if (project == null || project.isDefault() || !PlatformUtils.isPyCharm()) {
|
||||
myMakeAvailableToAllProjectsCheckbox.setSelected(true);
|
||||
myMakeAvailableToAllProjectsCheckbox.setVisible(false);
|
||||
@@ -125,7 +126,7 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
|
||||
checkValid();
|
||||
setInitialDestination();
|
||||
addUpdater(myName);
|
||||
new LocationNameFieldsBinding(project, myDestination, myName, myInitialPath, "Select Location for Virtual Environment");
|
||||
new LocationNameFieldsBinding(project, myDestination, myName, myInitialPath, PyBundle.message("sdk.create.venv.dialog.select.venv.location"));
|
||||
}
|
||||
|
||||
protected void setInitialDestination() {
|
||||
@@ -187,23 +188,23 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
|
||||
final String[] content = destFile.list();
|
||||
if (content != null && content.length != 0) {
|
||||
setOKActionEnabled(false);
|
||||
setErrorText("Directory is not empty");
|
||||
setErrorText(PyBundle.message("sdk.create.venv.dialog.error.not.empty.directory"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (StringUtil.isEmptyOrSpaces(projectName)) {
|
||||
setOKActionEnabled(false);
|
||||
setErrorText("VirtualEnv name can't be empty");
|
||||
setErrorText(PyBundle.message("sdk.create.venv.dialog.error.empty.venv.name"));
|
||||
return;
|
||||
}
|
||||
if (!PathUtil.isValidFileName(projectName)) {
|
||||
setOKActionEnabled(false);
|
||||
setErrorText("Invalid directory name");
|
||||
setErrorText(PyBundle.message("sdk.create.venv.dialog.error.invalid.directory.name"));
|
||||
return;
|
||||
}
|
||||
if (StringUtil.isEmptyOrSpaces(myDestination.getText())) {
|
||||
setOKActionEnabled(false);
|
||||
setErrorText("Destination directory can't be empty");
|
||||
setErrorText(PyBundle.message("sdk.create.venv.dialog.error.empty.venv.location"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,13 +239,13 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
|
||||
public void createVirtualEnv(final VirtualEnvCallback callback) {
|
||||
final ProgressManager progman = ProgressManager.getInstance();
|
||||
final Sdk basicSdk = getSdk();
|
||||
final Task.Modal createTask = new Task.Modal(myProject, "Creating virtual environment", false) {
|
||||
final Task.Modal createTask = new Task.Modal(myProject, PyBundle.message("sdk.create.venv.dialog.creating.venv"), false) {
|
||||
String myPath;
|
||||
|
||||
public void run(@NotNull final ProgressIndicator indicator) {
|
||||
|
||||
try {
|
||||
indicator.setText("Creating virtual environment");
|
||||
indicator.setText(PyBundle.message("sdk.create.venv.dialog.creating.venv"));
|
||||
myPath = createEnvironment(basicSdk);
|
||||
}
|
||||
catch (final ExecutionException e) {
|
||||
@@ -254,7 +255,7 @@ public abstract class AbstractCreateVirtualEnvDialog extends IdeaDialog {
|
||||
final PackageManagementService.ErrorDescription description =
|
||||
PyPackageManagementService.toErrorDescription(Collections.singletonList(e), basicSdk);
|
||||
if (description != null) {
|
||||
PackagesNotificationPanel.showError("Failed to Create Virtual Environment", description);
|
||||
PackagesNotificationPanel.showError(PyBundle.message("sdk.create.venv.dialog.error.failed.to.create.venv"), description);
|
||||
}
|
||||
}
|
||||
}, ModalityState.any());
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.CollectionComboBoxModel;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.packaging.PyCondaPackageManagerImpl;
|
||||
import com.jetbrains.python.packaging.PyCondaPackageService;
|
||||
import com.jetbrains.python.sdk.flavors.VirtualEnvSdkFlavor;
|
||||
@@ -51,7 +52,7 @@ public class CreateCondaEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
|
||||
protected void setupDialog(Project project, final List<Sdk> allSdks) {
|
||||
super.setupDialog(project, allSdks);
|
||||
setTitle("Create Conda Environment");
|
||||
setTitle(PyBundle.message("sdk.create.venv.conda.dialog.title"));
|
||||
final List<String> pythonVersions = UnsupportedFeaturesUtil.ALL_LANGUAGE_LEVELS;
|
||||
Collections.reverse(pythonVersions);
|
||||
mySdkCombo.setModel(new CollectionComboBoxModel<String>(pythonVersions));
|
||||
@@ -91,7 +92,7 @@ public class CreateCondaEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(new JBLabel("Name:"), c);
|
||||
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.name")), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 0;
|
||||
@@ -103,7 +104,7 @@ public class CreateCondaEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridy = 1;
|
||||
c.gridwidth = 1;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(new JBLabel("Location:"), c);
|
||||
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.location")), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 1;
|
||||
@@ -115,7 +116,7 @@ public class CreateCondaEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridy = 2;
|
||||
c.gridwidth = 1;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(new JBLabel("Python version:"), c);
|
||||
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.conda.dialog.label.python.version")), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 2;
|
||||
@@ -149,7 +150,7 @@ public class CreateCondaEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
super.checkValid();
|
||||
if (mySdkCombo.getSelectedItem() == null) {
|
||||
setOKActionEnabled(false);
|
||||
setErrorText("Select python version");
|
||||
setErrorText(PyBundle.message("sdk.create.venv.conda.dialog.error.no.python.version"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.intellij.ui.CollectionComboBoxModel;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.NullableConsumer;
|
||||
import com.jetbrains.python.PyBundle;
|
||||
import com.jetbrains.python.packaging.PyPackageManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class CreateVirtualEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
void setupDialog(Project project, final List<Sdk> allSdks) {
|
||||
super.setupDialog(project, allSdks);
|
||||
|
||||
setTitle("Create Virtual Environment");
|
||||
setTitle(PyBundle.message("sdk.create.venv.dialog.title"));
|
||||
|
||||
Iterables.removeIf(allSdks, new Predicate<Sdk>() {
|
||||
@Override
|
||||
@@ -84,7 +85,7 @@ public class CreateVirtualEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(new JBLabel("Name:"), c);
|
||||
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.name")), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 0;
|
||||
@@ -97,7 +98,7 @@ public class CreateVirtualEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridy = 1;
|
||||
c.gridwidth = 1;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(new JBLabel("Location:"), c);
|
||||
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.location")), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 1;
|
||||
@@ -109,7 +110,7 @@ public class CreateVirtualEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridy = 2;
|
||||
c.gridwidth = 1;
|
||||
c.weightx = 0.0;
|
||||
myMainPanel.add(new JBLabel("Base interpreter:"), c);
|
||||
myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.base.interpreter")), c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = 2;
|
||||
@@ -130,7 +131,7 @@ public class CreateVirtualEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
c.gridy = 3;
|
||||
c.gridwidth = 3;
|
||||
c.insets = new Insets(2,2,2,2);
|
||||
mySitePackagesCheckBox = new JBCheckBox("Inherit global site-packages");
|
||||
mySitePackagesCheckBox = new JBCheckBox(PyBundle.message("sdk.create.venv.dialog.label.inherit.global.site.packages"));
|
||||
myMainPanel.add(mySitePackagesCheckBox, c);
|
||||
|
||||
c.gridx = 0;
|
||||
@@ -194,7 +195,7 @@ public class CreateVirtualEnvDialog extends AbstractCreateVirtualEnvDialog {
|
||||
super.checkValid();
|
||||
if (mySdkCombo.getSelectedItem() == null) {
|
||||
setOKActionEnabled(false);
|
||||
setErrorText("Select base interpreter");
|
||||
setErrorText(PyBundle.message("sdk.create.venv.dialog.error.no.base.interpreter"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user