From 318ca1c5e810515105d003f5c2bfa2e02da11398 Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Fri, 27 Mar 2020 15:57:19 +0700 Subject: [PATCH] i18n: update bundle in `idea-repl #KT-37483 --- .../messages/KotlinIdeaReplBundle.properties | 31 ++++++++------- .../kotlin/console/KotlinConsoleKeeper.kt | 11 ++++-- .../kotlin/console/KotlinConsoleRunner.kt | 6 +-- .../kotlin/console/ReplOutputProcessor.kt | 4 +- .../console/actions/ConsoleModuleDialog.kt | 13 +++++-- .../console/actions/RunExecuteActions.kt | 4 +- .../console/gutter/ConsoleErrorRenderer.kt | 6 +-- .../kotlin/console/gutter/ReplIcons.kt | 38 +++++++++++++------ 8 files changed, 72 insertions(+), 41 deletions(-) diff --git a/idea/idea-repl/resources/messages/KotlinIdeaReplBundle.properties b/idea/idea-repl/resources/messages/KotlinIdeaReplBundle.properties index be6da9b02c3..d5e77b5ca35 100644 --- a/idea/idea-repl/resources/messages/KotlinIdeaReplBundle.properties +++ b/idea/idea-repl/resources/messages/KotlinIdeaReplBundle.properties @@ -1,22 +1,25 @@ -0.to.execute=<{0}> to execute +command.0.to.execute=<{0}> to execute build.and.restart=Build and restart build.module.0.and.restart=Build module ''{0}'' and restart cannot.find.project=Cannot find project choose.context.module=Choose context module... -error=Error: -executed.command=Executed command -history.of.executed.commands=History of executed commands -info=Info: -input.line=Input line -kotlin.repl=Kotlin REPL +icon.tool.tip.executed.command=Executed command +icon.tool.tip.history.of.executed.commands=History of executed commands +icon.tool.tip.input.line=Input line +icon.tool.tip.result=Result +icon.tool.tip.runtime.exception=Runtime exception +icon.tool.tip.system.help=System help +icon.tool.tip.waiting.for.input=Waiting for input... +icon.tool.tip.write.your.commands.here=Write your commands here +message.type.error=Error: +message.type.info=Info: +message.type.warning=Warning: +name.kotlin.repl=Kotlin REPL kotlin.repl.configuration.error=Kotlin REPL Configuration Error no.modules.were.found=No modules were found project.not.found=Project not found -result=Result -runtime.exception=Runtime exception -system.help=System help there.were.compilation.errors.in.module.0=There were compilation errors in module {0} -waiting.for.input=Waiting for input... -warning=Warning: -write.your.commands.here=Write your commands here -you.re.running.the.repl.with.outdated.classes=You’re running the REPL with outdated classes:\u0020 \ No newline at end of file +you.re.running.the.repl.with.outdated.classes=You’re running the REPL with outdated classes:\u0020 +constructor.title.0.in.module.1={0} (in module {1}) +build.module.0.and.restart1=Build module ''{0}'' and restart +internal.error.occurred.please.send.report.to.developers=Internal error occurred. Please, send report to developers.\n \ No newline at end of file diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt index d723bbc4c95..5e7eabb0b60 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleKeeper.kt @@ -16,8 +16,6 @@ import org.jetbrains.kotlin.utils.PathUtil import java.io.File import java.util.concurrent.ConcurrentHashMap -private val REPL_TITLE: String get() = KotlinIdeaReplBundle.message("kotlin.repl") - class KotlinConsoleKeeper(val project: Project) { private val consoleMap: MutableMap = ConcurrentHashMap() @@ -28,8 +26,15 @@ class KotlinConsoleKeeper(val project: Project) { fun run(module: Module, previousCompilationFailed: Boolean = false): KotlinConsoleRunner? { val path = module.moduleFilePath val cmdLine = createReplCommandLine(project, module) + val consoleRunner = KotlinConsoleRunner( + module, + cmdLine, + previousCompilationFailed, + project, + KotlinIdeaReplBundle.message("name.kotlin.repl"), + path + ) - val consoleRunner = KotlinConsoleRunner(module, cmdLine, previousCompilationFailed, project, REPL_TITLE, path) consoleRunner.initAndRun() return consoleRunner } diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleRunner.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleRunner.kt index ada549ddd6e..c6b72168090 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleRunner.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/KotlinConsoleRunner.kt @@ -123,7 +123,7 @@ class KotlinConsoleRunner( var compilerHelper: ConsoleCompilerHelper by Delegates.notNull() private val consoleScriptDefinition = object : KotlinScriptDefinition(Any::class) { - override val name get() = KotlinIdeaReplBundle.message("kotlin.repl") + override val name get() = KotlinIdeaReplBundle.message("name.kotlin.repl") override fun isScript(fileName: String): Boolean = fileName.startsWith(consoleView.virtualFile.name) override fun getScriptName(script: KtScript) = Name.identifier("REPL") } @@ -207,13 +207,13 @@ class KotlinConsoleRunner( override fun createConsoleExecAction(consoleExecuteActionHandler: ProcessBackedConsoleExecuteActionHandler) = ConsoleExecuteAction(consoleView, consoleExecuteActionHandler, KOTLIN_SHELL_EXECUTE_ACTION_ID, consoleExecuteActionHandler) - override fun constructConsoleTitle(title: String) = "$title (in module ${module.name})" + override fun constructConsoleTitle(title: String) = KotlinIdeaReplBundle.message("constructor.title.0.in.module.1", title, module.name) private fun setupPlaceholder(editor: EditorEx) { val executeCommandAction = ActionManager.getInstance().getAction(KOTLIN_SHELL_EXECUTE_ACTION_ID) val executeCommandActionShortcutText = KeymapUtil.getFirstKeyboardShortcutText(executeCommandAction) - editor.setPlaceholder(KotlinIdeaReplBundle.message("0.to.execute", executeCommandActionShortcutText)) + editor.setPlaceholder(KotlinIdeaReplBundle.message("command.0.to.execute", executeCommandActionShortcutText)) editor.setShowPlaceholderWhenFocused(true) val placeholderAttrs = TextAttributes() diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/ReplOutputProcessor.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/ReplOutputProcessor.kt index 73b1822d749..8fd5be6eddb 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/ReplOutputProcessor.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/ReplOutputProcessor.kt @@ -68,7 +68,7 @@ class ReplOutputProcessor( printOutput(message, ReplColors.WARNING_INFO_CONTENT_TYPE, ReplIcons.BUILD_WARNING_INDICATOR) if (isAddHyperlink) { - consoleView.printHyperlink("Build module '${runner.module.name}' and restart") { + consoleView.printHyperlink(KotlinIdeaReplBundle.message("build.module.0.and.restart1", runner.module.name)) { runner.compilerHelper.compileModule() } } @@ -145,7 +145,7 @@ class ReplOutputProcessor( } fun printInternalErrorMessage(internalErrorText: String) = WriteCommandAction.runWriteCommandAction(project) { - val promptText = "Internal error occurred. Please, send report to developers.\n" + val promptText = KotlinIdeaReplBundle.message("internal.error.occurred.please.send.report.to.developers") printOutput(promptText, ConsoleViewContentType.ERROR_OUTPUT, ReplIcons.RUNTIME_EXCEPTION) logError(this::class.java, internalErrorText) } diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/ConsoleModuleDialog.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/ConsoleModuleDialog.kt index 31fc494e99a..263f1bdee26 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/ConsoleModuleDialog.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/ConsoleModuleDialog.kt @@ -15,8 +15,6 @@ import org.jetbrains.kotlin.KotlinIdeaReplBundle import org.jetbrains.kotlin.console.KotlinConsoleKeeper class ConsoleModuleDialog(private val project: Project) { - private val TITLE get() = KotlinIdeaReplBundle.message("choose.context.module") - fun showIfNeeded(dataContext: DataContext) { val module = getModule(dataContext) if (module != null) return runConsole(module) @@ -30,7 +28,12 @@ class ConsoleModuleDialog(private val project: Project) { val moduleGroup = DefaultActionGroup(moduleActions) val modulePopup = JBPopupFactory.getInstance().createActionGroupPopup( - TITLE, moduleGroup, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true, ActionPlaces.UNKNOWN + TITLE, + moduleGroup, + dataContext, + JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, + true, + ActionPlaces.UNKNOWN ) modulePopup.showCenteredInCurrentWindow(project) @@ -52,4 +55,8 @@ class ConsoleModuleDialog(private val project: Project) { private fun createRunAction(module: Module) = object : AnAction(module.name) { override fun actionPerformed(e: AnActionEvent) = runConsole(module) } + + companion object { + private val TITLE get() = KotlinIdeaReplBundle.message("choose.context.module") + } } \ No newline at end of file diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/RunExecuteActions.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/RunExecuteActions.kt index 26148108728..02f93706bd3 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/RunExecuteActions.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/actions/RunExecuteActions.kt @@ -47,7 +47,9 @@ class BuildAndRestartConsoleAction( private val runner: KotlinConsoleRunner ) : AnAction( KotlinIdeaReplBundle.message("build.and.restart"), - KotlinIdeaReplBundle.message("build.module.0.and.restart", runner.module.name), AllIcons.Actions.Restart) { + KotlinIdeaReplBundle.message("build.module.0.and.restart", runner.module.name), + AllIcons.Actions.Restart +) { override fun actionPerformed(e: AnActionEvent) = runner.compilerHelper.compileModule() } \ No newline at end of file diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ConsoleErrorRenderer.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ConsoleErrorRenderer.kt index 52c40edff36..75e0b5bb368 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ConsoleErrorRenderer.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ConsoleErrorRenderer.kt @@ -23,9 +23,9 @@ import org.jetbrains.kotlin.diagnostics.Severity class ConsoleErrorRenderer(private val messages: List) : GutterIconRenderer() { private fun msgType(severity: Severity) = when (severity) { - Severity.ERROR -> KotlinIdeaReplBundle.message("error") - Severity.WARNING -> KotlinIdeaReplBundle.message("warning") - Severity.INFO -> KotlinIdeaReplBundle.message("info") + Severity.ERROR -> KotlinIdeaReplBundle.message("message.type.error") + Severity.WARNING -> KotlinIdeaReplBundle.message("message.type.warning") + Severity.INFO -> KotlinIdeaReplBundle.message("message.type.info") } override fun getTooltipText(): String { diff --git a/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ReplIcons.kt b/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ReplIcons.kt index bd977576577..9dad4638227 100644 --- a/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ReplIcons.kt +++ b/idea/idea-repl/src/org/jetbrains/kotlin/console/gutter/ReplIcons.kt @@ -25,23 +25,37 @@ data class IconWithTooltip(val icon: Icon, val tooltip: String?) object ReplIcons { val BUILD_WARNING_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.General.Warning, null) - val HISTORY_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.Vcs.History, - KotlinIdeaReplBundle.message("history.of.executed.commands") + val HISTORY_INDICATOR: IconWithTooltip = IconWithTooltip( + AllIcons.Vcs.History, + KotlinIdeaReplBundle.message("icon.tool.tip.history.of.executed.commands") ) - val EDITOR_INDICATOR: IconWithTooltip = IconWithTooltip(KotlinIcons.LAUNCH, KotlinIdeaReplBundle.message("write.your.commands.here")) - val EDITOR_READLINE_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.General.Balloon, - KotlinIdeaReplBundle.message("waiting.for.input") + + val EDITOR_INDICATOR: IconWithTooltip = IconWithTooltip( + KotlinIcons.LAUNCH, + KotlinIdeaReplBundle.message("icon.tool.tip.write.your.commands.here") ) - val COMMAND_MARKER: IconWithTooltip = IconWithTooltip(AllIcons.RunConfigurations.TestState.Run, - KotlinIdeaReplBundle.message("executed.command") + + val EDITOR_READLINE_INDICATOR: IconWithTooltip = IconWithTooltip( + AllIcons.General.Balloon, + KotlinIdeaReplBundle.message("icon.tool.tip.waiting.for.input") + ) + + val COMMAND_MARKER: IconWithTooltip = IconWithTooltip( + AllIcons.RunConfigurations.TestState.Run, + KotlinIdeaReplBundle.message("icon.tool.tip.executed.command") + ) + + val READLINE_MARKER: IconWithTooltip = IconWithTooltip( + AllIcons.Debugger.PromptInput, + KotlinIdeaReplBundle.message("icon.tool.tip.input.line") ) - val READLINE_MARKER: IconWithTooltip = IconWithTooltip(AllIcons.Debugger.PromptInput, KotlinIdeaReplBundle.message("input.line")) // command result icons - val SYSTEM_HELP: IconWithTooltip = IconWithTooltip(AllIcons.Actions.Help, KotlinIdeaReplBundle.message("system.help")) - val RESULT: IconWithTooltip = IconWithTooltip(AllIcons.Vcs.Equal, KotlinIdeaReplBundle.message("result")) + val SYSTEM_HELP: IconWithTooltip = IconWithTooltip(AllIcons.Actions.Help, KotlinIdeaReplBundle.message("icon.tool.tip.system.help")) + val RESULT: IconWithTooltip = IconWithTooltip(AllIcons.Vcs.Equal, KotlinIdeaReplBundle.message("icon.tool.tip.result")) val COMPILER_ERROR: Icon = AllIcons.General.Error - val RUNTIME_EXCEPTION: IconWithTooltip = IconWithTooltip(AllIcons.General.BalloonWarning, - KotlinIdeaReplBundle.message("runtime.exception") + val RUNTIME_EXCEPTION: IconWithTooltip = IconWithTooltip( + AllIcons.General.BalloonWarning, + KotlinIdeaReplBundle.message("icon.tool.tip.runtime.exception") ) } \ No newline at end of file