Python: localize string

GitOrigin-RevId: 63f2e888bff6d4e9ebccf67d43c6d9a927cba900
This commit is contained in:
Ilya.Kazakevich
2025-06-25 16:54:15 +00:00
committed by intellij-monorepo-bot
parent 5e098a2239
commit 3156c22dee
3 changed files with 19 additions and 1 deletions
@@ -0,0 +1 @@
py.system.python.service.python.is.broken=Python {0} is broken
@@ -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)
}
}
@@ -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<SystemPython> {
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)