diff --git a/python/services/system-python/resources/messages/PySystemPythonBundle.properties b/python/services/system-python/resources/messages/PySystemPythonBundle.properties new file mode 100644 index 000000000000..61e9ca7beb31 --- /dev/null +++ b/python/services/system-python/resources/messages/PySystemPythonBundle.properties @@ -0,0 +1 @@ +py.system.python.service.python.is.broken=Python {0} is broken \ No newline at end of file diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/PySystemPythonBundle.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/PySystemPythonBundle.kt new file mode 100644 index 000000000000..73da436a64f6 --- /dev/null +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/impl/PySystemPythonBundle.kt @@ -0,0 +1,15 @@ +package com.intellij.python.community.services.systemPython.impl + +import com.intellij.DynamicBundle +import org.jetbrains.annotations.Nls +import org.jetbrains.annotations.PropertyKey + +internal object PySystemPythonBundle { + private const val BUNDLE = "messages.PySystemPythonBundle" + + private val INSTANCE = DynamicBundle(PySystemPythonBundle::class.java, BUNDLE) + + fun message(key: @PropertyKey(resourceBundle = BUNDLE) String, vararg params: Any): @Nls String { + return INSTANCE.getMessage(key, *params) + } +} \ No newline at end of file diff --git a/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt b/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt index 207aeb41f9d2..b6262a4fb0ae 100644 --- a/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt +++ b/python/services/system-python/src/com/intellij/python/community/services/systemPython/systemPythonServiceImpl.kt @@ -16,6 +16,7 @@ import com.intellij.python.community.services.shared.UICustomization import com.intellij.python.community.services.systemPython.SystemPythonServiceImpl.MyServiceState import com.intellij.python.community.services.systemPython.impl.Cache import com.intellij.python.community.services.systemPython.impl.CoreSystemPythonProvider +import com.intellij.python.community.services.systemPython.impl.PySystemPythonBundle import com.jetbrains.python.PythonBinary import com.jetbrains.python.Result import com.jetbrains.python.errorProcessing.PyResult @@ -63,7 +64,8 @@ internal class SystemPythonServiceImpl(scope: CoroutineScope) : SystemPythonServ } override suspend fun registerSystemPython(pythonPath: PythonBinary): PyResult { - val pythonWithLangLevel = VanillaPythonWithLanguageLevelImpl.createByPythonBinary(pythonPath).getOr("Python {$pythonPath} is broken") { return it } + val pythonWithLangLevel = VanillaPythonWithLanguageLevelImpl.createByPythonBinary(pythonPath) + .getOr(PySystemPythonBundle.message("py.system.python.service.python.is.broken", pythonPath)) { return it } val systemPython = SystemPython(pythonWithLangLevel, null) state.userProvidedPythons.add(pythonPath.pathString) cache()?.get(pythonPath.getEelDescriptor())?.add(systemPython)