i18n: Interpreter settings

GitOrigin-RevId: 6eed8f2f1e4725ec617e7df0c861744cdf8e2be9
This commit is contained in:
Lada Gagina
2020-08-19 20:13:54 +03:00
committed by intellij-monorepo-bot
parent bc033ffba5
commit 2f53b0d8f2
8 changed files with 29 additions and 14 deletions

View File

@@ -1836,6 +1836,7 @@ action.SetupMiniconda.installerMissing=Miniconda installer doesn't exist, please
action.SetupMiniconda.installDirectoryIsNotEmpty=Installation folder {0} is not empty - please specify another location
action.SetupMiniconda.installDirectoryMissing=Installation folder can not be empty - please specify location
action.SetupMiniconda.canNotWriteToInstallationDirectory=Can not install to {0} folder (no permissions) - please specify another location
action.SetupMiniconda.internal.error=Internal error
group.FilePropertiesGroup.text=File Properties
group.FileExportGroup.text=Export

View File

@@ -12,6 +12,7 @@ import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.Task
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.NlsSafe
import com.intellij.util.ExceptionUtil
import com.jetbrains.python.PythonCondaBundle
import com.jetbrains.python.conda.InstallCondaUtils
@@ -71,11 +72,11 @@ class InstallCondaAction : AnAction(ActionsBundle.message("action.SetupMiniconda
project)
}
private fun reportFailure(project: Project?, e: Exception) {
return reportFailure(project, ExceptionUtil.getNonEmptyMessage(e, "Internal error"))
private fun reportFailure(project: Project?, @NlsSafe e: Exception) {
return reportFailure(project, ExceptionUtil.getNonEmptyMessage(e, ActionsBundle.message("action.SetupMiniconda.internal.error")))
}
private fun reportFailure(project: Project?, message: String = "Internal error") {
private fun reportFailure(project: Project?, @NlsSafe message: String = ActionsBundle.message("action.SetupMiniconda.internal.error")) {
Notifications.Bus.notify(
Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
ActionsBundle.message("action.SetupMiniconda.installFailed"),

View File

@@ -12,6 +12,7 @@ import com.intellij.openapi.util.Key
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.text.StringUtil
import com.intellij.util.SystemProperties
import org.jetbrains.annotations.Nls
import java.io.File
/**
@@ -110,6 +111,7 @@ object InstallCondaUtils {
* @return String with error message or null if none
*/
@JvmStatic
@Nls(capitalization = Nls.Capitalization.Sentence)
fun checkPath(path: String): String? {
if (path.isBlank())
return ActionsBundle.message("action.SetupMiniconda.installDirectoryMissing")

View File

@@ -24,6 +24,7 @@ import com.intellij.ide.util.projectWizard.importSources.ProjectFromSourcesBuild
import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.WebModuleTypeBase;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.io.FileUtilRt;
import com.jetbrains.python.PythonModuleTypeBase;
import org.jetbrains.annotations.NotNull;
@@ -39,21 +40,21 @@ import java.util.List;
*/
public class PyProjectStructureDetector extends ProjectStructureDetector {
private static final Logger LOG = Logger.getInstance(PyProjectStructureDetector.class);
public static final @NlsSafe String PYTHON = "Python";
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
File @NotNull [] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
LOG.info("Detecting roots under " + dir);
LOG.info("Detecting roots under " + dir);
for (File child : children) {
final String name = child.getName();
if (FileUtilRt.extensionEquals(name, "py")) {
LOG.info("Found Python file " + child.getPath());
result.add(new DetectedContentRoot(dir, "Python", PythonModuleTypeBase.getInstance(),
WebModuleTypeBase.getInstance()));
result.add(new DetectedContentRoot(dir, PYTHON, PythonModuleTypeBase.getInstance(), WebModuleTypeBase.getInstance()));
return DirectoryProcessingResult.SKIP_CHILDREN;
}
if ("node_modules".equals(name)) {

View File

@@ -1,2 +1,4 @@
python.sdk.run.wait=Wait...
sdk.options.additional.data.tab.title=Packages
python.sdk.flavor.cannot.find.conda=Cannot find conda executable
python.skeleton.generator.broken.home.path=Broken home path for {0}

View File

@@ -13,6 +13,7 @@ import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.util.text.StringUtil
import com.jetbrains.python.PySdkBundle
import com.jetbrains.python.packaging.IndicatedProcessOutputListener
import com.jetbrains.python.packaging.PyCondaPackageService
import com.jetbrains.python.packaging.PyExecutionException
@@ -58,7 +59,8 @@ private fun readCondaEnv(condaExecutable: String): Map<String, String>? {
@Throws(ExecutionException::class)
private fun findCondaExecutable(sdk: Sdk?): String {
return PyCondaPackageService.getCondaExecutable(sdk?.homePath) ?: throw ExecutionException("Cannot find conda executable")
return PyCondaPackageService.getCondaExecutable(sdk?.homePath) ?: throw ExecutionException(
PySdkBundle.message("python.sdk.flavor.cannot.find.conda"))
}
@Throws(PyExecutionException::class)

View File

@@ -18,6 +18,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Time;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PySdkBundle;
import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.sdk.InvalidSdkException;
import com.jetbrains.python.sdk.PySdkUtil;
@@ -246,7 +247,9 @@ public class PySkeletonGenerator {
return myWorkingDir;
}
final String binaryPath = mySdk.getHomePath();
if (binaryPath == null) throw new InvalidSdkException("Broken home path for " + mySdk.getName());
if (binaryPath == null) {
throw new InvalidSdkException(PySdkBundle.message("python.skeleton.generator.broken.home.path", mySdk.getName()));
}
return new File(binaryPath).getParent();
}
@@ -485,8 +488,8 @@ public class PySkeletonGenerator {
// unreliable in case of remote interpreters where target and host OS might differ.
// Closing the underlying input stream should be handled by its owner.
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(input, StandardCharsets.UTF_8));
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed") final BufferedWriter writer =
new BufferedWriter(new OutputStreamWriter(input, StandardCharsets.UTF_8));
writer.write(line);
writer.write('\n');
writer.flush();

View File

@@ -36,6 +36,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import static com.intellij.openapi.util.NlsContexts.ProgressDetails;
import static com.intellij.openapi.util.NlsContexts.ProgressText;
/**
* Handles a refresh of SDK's skeletons.
* Does all the heavy lifting calling skeleton generator, managing blacklists, etc.
@@ -187,7 +190,7 @@ public class PySkeletonRefresher {
}
}
private void indicate(String msg) {
private void indicate(@ProgressText String msg) {
LOG.debug("Progress message: " + msg);
if (myIndicator != null) {
myIndicator.checkCanceled();
@@ -196,7 +199,7 @@ public class PySkeletonRefresher {
}
}
private void indicateMinor(String msg) {
private void indicateMinor(@ProgressDetails String msg) {
LOG.debug("Progress message (minor): " + msg);
if (myIndicator != null) {
myIndicator.setText2(msg);