Move all messages from the dialogs for creating venv and Conda environments to PyBundle
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Fri, 23 Oct 2015 09:45:35 +0000 (12:45 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Sun, 25 Oct 2015 12:49:43 +0000 (15:49 +0300)
python/src/com/jetbrains/python/PyBundle.properties
python/src/com/jetbrains/python/sdk/AbstractCreateVirtualEnvDialog.java
python/src/com/jetbrains/python/sdk/CreateCondaEnvDialog.java
python/src/com/jetbrains/python/sdk/CreateVirtualEnvDialog.java

index 36b65eeb6c2d73fde96deb430b9b03db96ec233c..1edb08b726c60ad37c93eb0c12f4644d4f031304 100644 (file)
@@ -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
index 859130d11884cdde9b238382a7b2a399d64b3c01..cd2d26197c61096129a15c9c41ff84175c216bb6 100644 (file)
@@ -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());
index 1172784447247b8691168b7503c2228e900199df..5611ba429f617c796c28f80c80413a9f9bd9ace0 100644 (file)
@@ -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"));
     }
   }
 
index 81f99ecc323d9fe9153d0d1b48d1ae42bbe387d2..6ef5234b36ba31c422fb5b8e2f5e170cb3e37068 100644 (file)
@@ -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"));
     }
   }