diff --git a/idea/resources/messages/KotlinInternalBundle.properties b/idea/resources/messages/KotlinInternalBundle.properties new file mode 100644 index 00000000000..e96fa8651d9 --- /dev/null +++ b/idea/resources/messages/KotlinInternalBundle.properties @@ -0,0 +1,4 @@ +action.text.decompile.kotlin.bytecode=Decompile kotlin bytecode +error.text.cannot.decompile=Cannot decompile {0} +indicator.text.decompiling=Decompiling {0} +title.decompiler.error=Decompiler error \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/internal/KotlinDecompilerAdapter.kt b/idea/src/org/jetbrains/kotlin/idea/internal/KotlinDecompilerAdapter.kt index a1b7e439d6b..4d937170c61 100644 --- a/idea/src/org/jetbrains/kotlin/idea/internal/KotlinDecompilerAdapter.kt +++ b/idea/src/org/jetbrains/kotlin/idea/internal/KotlinDecompilerAdapter.kt @@ -25,11 +25,14 @@ fun showDecompiledCode(sourceFile: KtFile) { ProgressManager.getInstance().run(KotlinBytecodeDecompilerTask(sourceFile)) } -class KotlinBytecodeDecompilerTask(val file: KtFile) : Task.Backgroundable(file.project, "Decompile kotlin bytecode") { +class KotlinBytecodeDecompilerTask(val file: KtFile) : Task.Backgroundable( + file.project, + KotlinInternalBundle.message("action.text.decompile.kotlin.bytecode") +) { override fun run(indicator: ProgressIndicator) { val decompilerService = KotlinDecompilerService.getInstance() ?: return - indicator.text = "Decompiling ${file.name}" + indicator.text = KotlinInternalBundle.message("indicator.text.decompiling", file.name) val decompiledText = try { decompilerService.decompile(file) @@ -43,7 +46,10 @@ class KotlinBytecodeDecompilerTask(val file: KtFile) : Task.Backgroundable(file. if (decompiledText == null) { ApplicationManager.getApplication().invokeLater { - Messages.showErrorDialog("Cannot decompile ${file.name}", "Decompiler error") + Messages.showErrorDialog( + KotlinInternalBundle.message("error.text.cannot.decompile", file.name), + KotlinInternalBundle.message("title.decompiler.error") + ) } return@runWriteAction } diff --git a/idea/src/org/jetbrains/kotlin/idea/internal/KotlinInternalBundle.kt b/idea/src/org/jetbrains/kotlin/idea/internal/KotlinInternalBundle.kt new file mode 100644 index 00000000000..482e542750f --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/internal/KotlinInternalBundle.kt @@ -0,0 +1,18 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.internal + +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey +import org.jetbrains.kotlin.util.AbstractKotlinBundle + +@NonNls +private const val BUNDLE = "messages.KotlinInternalBundle" + +object KotlinInternalBundle : AbstractKotlinBundle(BUNDLE) { + @JvmStatic + fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params) +}