i18n: add bundle for idea/internal
This commit is contained in:
@@ -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
|
||||||
@@ -25,11 +25,14 @@ fun showDecompiledCode(sourceFile: KtFile) {
|
|||||||
ProgressManager.getInstance().run(KotlinBytecodeDecompilerTask(sourceFile))
|
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) {
|
override fun run(indicator: ProgressIndicator) {
|
||||||
val decompilerService = KotlinDecompilerService.getInstance() ?: return
|
val decompilerService = KotlinDecompilerService.getInstance() ?: return
|
||||||
|
|
||||||
indicator.text = "Decompiling ${file.name}"
|
indicator.text = KotlinInternalBundle.message("indicator.text.decompiling", file.name)
|
||||||
|
|
||||||
val decompiledText = try {
|
val decompiledText = try {
|
||||||
decompilerService.decompile(file)
|
decompilerService.decompile(file)
|
||||||
@@ -43,7 +46,10 @@ class KotlinBytecodeDecompilerTask(val file: KtFile) : Task.Backgroundable(file.
|
|||||||
|
|
||||||
if (decompiledText == null) {
|
if (decompiledText == null) {
|
||||||
ApplicationManager.getApplication().invokeLater {
|
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
|
return@runWriteAction
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user