diff --git a/idea/idea-maven/resources/org/jetbrains/kotlin/idea/maven/KotlinMavenBundle.properties b/idea/idea-maven/resources/org/jetbrains/kotlin/idea/maven/KotlinMavenBundle.properties
new file mode 100644
index 00000000000..db13b73d28e
--- /dev/null
+++ b/idea/idea-maven/resources/org/jetbrains/kotlin/idea/maven/KotlinMavenBundle.properties
@@ -0,0 +1,54 @@
+configure.title=Configure Kotlin-Maven plugin
+configure.java.with.maven=Java with Maven
+configure.javascript.with.maven=JavaScript with Maven
+
+version.different.maven.ide=Kotlin version that is used for building with Maven ({0}) differs from the one bundled into the IDE plugin ({1})
+version.different.plugin.library=Plugin version ({0}) is not the same as library version ({1})
+
+change.version=Change version
+change.version.to=Change version to {0}
+change.version.to.resolved=Change version to {0} ({1})
+
+error.cant.find.pom.for.module=Cannot find pom.xml for module ''{0}''
+
+file.was.modified={0} was modified
+
+update.language.version.title=Update Language Version
+update.language.version.feature=This language feature requires version ''{0}'' or later of the Kotlin runtime library. Please update the version in your build script.
+update.language.version.feature.support={0} support requires version ''{1}'' or later of the Kotlin runtime library. Please update the version in your build script.
+update.language.version.coroutines=Coroutines support requires version ''1.1'' or later of the Kotlin runtime library. Please update the version in your build script.
+
+error.failed.update.pom=Failed to update pom.xml. Please update the file manually.
+error.cant.configure.maven.automatically=Couldn't configure kotlin-maven plugin automatically.
+error.see.installation.instructions=See manual installation instructions here.
+
+inspection.description=Reports kotlin-maven-plugin configuration issues
+inspection.no.executions=Kotlin plugin has no compile executions
+inspection.should.run.before.javac=Kotlin plugin should run before javac so kotlin classes could be visible from Java
+inspection.javascript.in.java.module=JavaScript goal configured for module with Java files
+inspection.jvm.no.stdlib.dependency=Kotlin/JVM compiler configured but no ''{0}'' dependency
+inspection.javascript.no.stdlib.dependency=Kotlin/JavaScript compiler configured but no ''{0}'' dependency
+inspection.configured.no.execution=You have {0} configured but no corresponding plugin execution
+inspection.same.execution.compile.test=It is not recommended to have both ''compile'' and ''test'' goals in the same execution
+
+fix.create.execution.name="Create {0} execution
+fix.create.execution.family="Create Kotlin execution
+
+fix.change.phase.name=Change phase to {0}
+fix.change.phase.family=Change phase
+
+fix.configure.right.order=Configure maven-compiler-plugin executions in the right order
+
+fix.add.dependency.name=Add ''{0}'' dependency
+fix.add.dependency.family=Add dependency
+
+fix.create.execution.compiler.name=Create ''{0}'' execution of kotlin-maven-compiler
+fix.create.execution.compiler.family=Create Kotlin execution
+
+fix.add.maven.dependency.name=Add Maven dependency…
+
+fix.kotlin.test.junit.is.recommended=''kotlin-test-junit'' is recommended
+fix.kotlin.test.junit.replace=Replace with ''kotlin-test-junit''
+
+fix.move.to.compile.execution=Move to ''compile'' execution
+fix.move.to.build.sourceDirectory.tag=Move to ''build'' > ''sourceDirectory'' tag
\ No newline at end of file
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenBundle.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenBundle.kt
new file mode 100644
index 00000000000..b5e284736fd
--- /dev/null
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenBundle.kt
@@ -0,0 +1,24 @@
+/*
+ * 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.maven
+
+import com.intellij.CommonBundle
+import org.jetbrains.annotations.NonNls
+import org.jetbrains.annotations.PropertyKey
+import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
+import java.util.*
+
+object KotlinMavenBundle : KotlinBundleBase() {
+ @NonNls
+ private const val BUNDLE = "org.jetbrains.kotlin.idea.maven.KotlinMavenBundle"
+
+ override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
+
+ @JvmStatic
+ fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
+ return CommonBundle.message(bundle, key, *params)
+ }
+}
\ No newline at end of file
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/actions/MavenPluginSourcesSwap.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/actions/MavenPluginSourcesSwap.kt
index ad3aca11369..9c669adee8b 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/actions/MavenPluginSourcesSwap.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/actions/MavenPluginSourcesSwap.kt
@@ -28,12 +28,13 @@ import com.intellij.util.xml.GenericDomValue
import org.jetbrains.idea.maven.dom.MavenDomUtil
import org.jetbrains.idea.maven.dom.model.MavenDomBuild
import org.jetbrains.idea.maven.dom.model.MavenDomPluginExecution
+import org.jetbrains.kotlin.idea.maven.KotlinMavenBundle
import org.jetbrains.kotlin.idea.maven.PomFile
import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
class MavenPluginSourcesMoveToExecutionIntention : PsiElementBaseIntentionAction() {
- override fun getFamilyName() = "Move to compile execution"
+ override fun getFamilyName() = KotlinMavenBundle.message("fix.move.to.compile.execution")
override fun getText() = familyName
override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean {
@@ -95,7 +96,7 @@ class MavenPluginSourcesMoveToExecutionIntention : PsiElementBaseIntentionAction
}
class MavenPluginSourcesMoveToBuild : PsiElementBaseIntentionAction() {
- override fun getFamilyName() = "Move to build>sourceDirectory tag"
+ override fun getFamilyName() = KotlinMavenBundle.message("fix.move.to.build.sourceDirectory.tag")
override fun getText() = familyName
override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean {
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt
index c342c8c3908..0f76a447973 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavaMavenConfigurator.kt
@@ -23,6 +23,7 @@ import org.jetbrains.idea.maven.dom.model.MavenDomPlugin
import org.jetbrains.kotlin.idea.configuration.NotificationMessageCollector
import org.jetbrains.kotlin.idea.configuration.addStdlibToJavaModuleInfo
import org.jetbrains.kotlin.idea.configuration.hasKotlinJvmRuntimeInScope
+import org.jetbrains.kotlin.idea.maven.KotlinMavenBundle
import org.jetbrains.kotlin.idea.maven.PomFile
import org.jetbrains.kotlin.idea.versions.getDefaultJvmTarget
import org.jetbrains.kotlin.idea.versions.getStdlibArtifactId
@@ -76,6 +77,6 @@ class KotlinJavaMavenConfigurator : KotlinMavenConfigurator(
companion object {
private const val NAME = "maven"
const val TEST_LIB_ID = "kotlin-test"
- private const val PRESENTABLE_TEXT = "Java with Maven"
+ private val PRESENTABLE_TEXT = KotlinMavenBundle.message("configure.java.with.maven")
}
}
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt
index aff931717aa..4576c2fafc8 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinJavascriptMavenConfigurator.kt
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.maven.configuration
import com.intellij.openapi.module.Module
import org.jetbrains.idea.maven.dom.model.MavenDomPlugin
import org.jetbrains.kotlin.idea.configuration.hasKotlinJsRuntimeInScope
+import org.jetbrains.kotlin.idea.maven.KotlinMavenBundle
import org.jetbrains.kotlin.idea.maven.PomFile
import org.jetbrains.kotlin.idea.versions.MAVEN_JS_STDLIB_ID
import org.jetbrains.kotlin.platform.TargetPlatform
@@ -52,6 +53,6 @@ class KotlinJavascriptMavenConfigurator :
companion object {
private const val NAME = "js maven"
- private const val PRESENTABLE_TEXT = "JavaScript with Maven"
+ private val PRESENTABLE_TEXT = KotlinMavenBundle.message("configure.javascript.with.maven")
}
}
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt
index 093a50c2f8e..19b4da920b7 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/configuration/KotlinMavenConfigurator.kt
@@ -114,7 +114,7 @@ protected constructor(
configureModule(module, file, dialog.kotlinVersion, collector)
OpenFileAction.openFile(file.virtualFile, project)
} else {
- showErrorMessage(project, "Cannot find pom.xml for module " + module.name)
+ showErrorMessage(project, KotlinMavenBundle.message("error.cant.find.pom.for.module", module.name))
}
}
collector.showNotification()
@@ -176,7 +176,7 @@ protected constructor(
CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(file)
- collector.addMessage(virtualFile.path + " was modified")
+ collector.addMessage(KotlinMavenBundle.message("file.was.modified", virtualFile.path))
return true
}
@@ -221,9 +221,8 @@ protected constructor(
if (runtimeUpdateRequired) {
Messages.showErrorDialog(
module.project,
- "This language feature requires version $requiredStdlibVersion or later of the Kotlin runtime library. " +
- "Please update the version in your build script.",
- "Update Language Version"
+ KotlinMavenBundle.message("update.language.version.feature", requiredStdlibVersion),
+ KotlinMavenBundle.message("update.language.version.title")
)
return
}
@@ -232,8 +231,8 @@ protected constructor(
if (element == null) {
Messages.showErrorDialog(
module.project,
- "Failed to update.pom.xml. Please update the file manually.",
- "Update Language Version"
+ KotlinMavenBundle.message("error.failed.update.pom"),
+ KotlinMavenBundle.message("update.language.version.title")
)
} else {
OpenFileDescriptor(module.project, element.containingFile.virtualFile, element.textRange.startOffset).navigate(true)
@@ -258,8 +257,7 @@ protected constructor(
if (runtimeUpdateRequired) {
Messages.showErrorDialog(
module.project,
- "Coroutines support requires version 1.1 or later of the Kotlin runtime library. " +
- "Please update the version in your build script.",
+ KotlinMavenBundle.message("update.language.version.coroutines"),
messageTitle
)
return
@@ -285,8 +283,7 @@ protected constructor(
if (state != LanguageFeature.State.DISABLED && getRuntimeLibraryVersion(module).toApiVersion() < sinceVersion) {
Messages.showErrorDialog(
module.project,
- "${feature.presentableName} support requires version $sinceVersion or later of the Kotlin runtime library. " +
- "Please update the version in your build script.",
+ KotlinMavenBundle.message("update.language.version.feature.support", feature.presentableName, sinceVersion),
messageTitle
)
return
@@ -317,7 +314,7 @@ protected constructor(
if (element == null) {
Messages.showErrorDialog(
module.project,
- "Failed to update.pom.xml. Please update the file manually.",
+ KotlinMavenBundle.message("error.failed.update.pom"),
messageTitle
)
}
@@ -336,7 +333,7 @@ protected constructor(
if (element == null) {
Messages.showErrorDialog(
module.project,
- "Failed to update.pom.xml. Please update the file manually.",
+ KotlinMavenBundle.message("error.failed.update.pom"),
messageTitle
)
}
@@ -369,12 +366,13 @@ protected constructor(
}
private fun showErrorMessage(project: Project, message: String?) {
+ val cantConfigureAutomatically = KotlinMavenBundle.message("error.cant.configure.maven.automatically")
+ val seeInstructions = KotlinMavenBundle.message("error.see.installation.instructions")
+
Messages.showErrorDialog(
project,
- "Couldn't configure kotlin-maven plugin automatically.
" +
- (if (message != null) "$message" else "") +
- "See manual installation instructions here.",
- "Configure Kotlin-Maven Plugin"
+ "$cantConfigureAutomatically
${if (message != null) "$message" else ""}$seeInstructions",
+ KotlinMavenBundle.message("configure.title")
)
}
}
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/DifferentKotlinMavenVersionInspection.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/DifferentKotlinMavenVersionInspection.kt
index 842fd3f5e34..41df2e5e329 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/DifferentKotlinMavenVersionInspection.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/DifferentKotlinMavenVersionInspection.kt
@@ -14,6 +14,7 @@ import org.jetbrains.idea.maven.dom.model.MavenDomPlugin
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel
import org.jetbrains.idea.maven.project.MavenProjectsManager
import org.jetbrains.kotlin.idea.inspections.PluginVersionDependentInspection
+import org.jetbrains.kotlin.idea.maven.KotlinMavenBundle
import org.jetbrains.kotlin.idea.maven.PomFile
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
@@ -43,12 +44,13 @@ class DifferentKotlinMavenVersionInspection : DomElementsInspection, val newVersion: String, val versionResolved: String?) :
LocalQuickFix {
- override fun getName() =
- if (versionResolved == null) "Change version to $newVersion" else "Change version to $newVersion ($versionResolved)"
+ override fun getName() = when (versionResolved) {
+ null -> KotlinMavenBundle.message("change.version.to", newVersion)
+ else -> KotlinMavenBundle.message("change.version.to.resolved", newVersion, versionResolved)
+ }
- override fun getFamilyName() = "Change version"
+ override fun getFamilyName() = KotlinMavenBundle.message("change.version")
override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
versionElement.value = newVersion
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt
index dcd0e6f7c57..956593ebd7a 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinMavenPluginPhaseInspection.kt
@@ -25,6 +25,7 @@ import org.jetbrains.idea.maven.model.MavenId
import org.jetbrains.idea.maven.model.MavenPlugin
import org.jetbrains.idea.maven.project.MavenProjectsManager
import org.jetbrains.idea.maven.utils.MavenArtifactScope
+import org.jetbrains.kotlin.idea.maven.KotlinMavenBundle
import org.jetbrains.kotlin.idea.maven.PomFile
import org.jetbrains.kotlin.idea.maven.configuration.KotlinMavenConfigurator
import org.jetbrains.kotlin.idea.platform.tooling
@@ -42,7 +43,7 @@ class KotlinMavenPluginPhaseInspection : DomElementsInspection?, holder: DomElementAnnotationHolder?) {
if (domFileElement == null || holder == null) {
@@ -80,7 +81,7 @@ class KotlinMavenPluginPhaseInspection : DomElementsInspection
) :
IntentionAction, LowPriorityAction {
- override fun getText() = "Add Maven dependency..."
+ override fun getText() = KotlinMavenBundle.message("fix.add.maven.dependency.name")
override fun getFamilyName() = text
override fun startInWriteAction() = false
override fun isAvailable(project: Project, editor: Editor?, file: PsiFile?) =
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinTestJUnitInspection.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinTestJUnitInspection.kt
index 555c8ba2a99..295da287411 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinTestJUnitInspection.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/inspections/KotlinTestJUnitInspection.kt
@@ -15,6 +15,7 @@ import com.intellij.util.xml.highlighting.DomElementsInspection
import org.jetbrains.idea.maven.dom.model.MavenDomDependency
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel
import org.jetbrains.idea.maven.project.MavenProjectsManager
+import org.jetbrains.kotlin.idea.maven.KotlinMavenBundle
import org.jetbrains.kotlin.idea.maven.configuration.KotlinJavaMavenConfigurator
import org.jetbrains.kotlin.idea.maven.configuration.KotlinMavenConfigurator
@@ -41,14 +42,14 @@ class KotlinTestJUnitInspection : DomElementsInspection(Ma
holder.createProblem(
it.artifactId,
HighlightSeverity.WEAK_WARNING,
- "kotlin-test-junit is better with junit",
+ KotlinMavenBundle.message("fix.kotlin.test.junit.is.recommended"),
ReplaceToKotlinTest(it)
)
}
}
private class ReplaceToKotlinTest(val dependency: MavenDomDependency) : LocalQuickFix {
- override fun getName() = "Replace with kotlin-test-junit"
+ override fun getName() = KotlinMavenBundle.message("fix.kotlin.test.junit.replace")
override fun getFamilyName() = name
override fun applyFix(project: Project, descriptor: ProblemDescriptor) {