diff --git a/idea/resources/messages/KotlinFacetBundle.properties b/idea/resources/messages/KotlinFacetBundle.properties new file mode 100644 index 00000000000..9118ae780a4 --- /dev/null +++ b/idea/resources/messages/KotlinFacetBundle.properties @@ -0,0 +1,14 @@ +checkbox.text.use.project.settings=Use project settings +column.name.options=Options +column.name.plugin=Plugin +error.text.at.least.one.target.platform.should.be.selected=At least one target platform should be selected +label.text.selected.target.platforms=Selected target platforms: +label.text.target.platform=Target platform: +label.text.the.project.is.imported.from.external.build.system.and.could.not.be.edited=The project is imported from external build system and could not be edited +link.text.edit.project.settings=Edit project settings +name.compiler.plugins=Compiler Plugins +name.general=General +text.following.arguments.are.redundant=Following arguments are redundant: {0} +text.following.arguments.override.facet.settings=Following arguments override facet settings: {0} +text.following.options.are.not.correct=Following options are not correct: +text.multiplatform=Multiplatform diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetBundle.kt b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetBundle.kt new file mode 100644 index 00000000000..937589fe073 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetBundle.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.facet + +import org.jetbrains.annotations.NonNls +import org.jetbrains.annotations.PropertyKey +import org.jetbrains.kotlin.util.AbstractKotlinBundle + +@NonNls +private const val BUNDLE = "messages.KotlinFacetBundle" + +object KotlinFacetBundle : AbstractKotlinBundle(BUNDLE) { + @JvmStatic + fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params) +} diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetCompilerPluginsTab.kt b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetCompilerPluginsTab.kt index c9897755a04..bec9c2a118b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetCompilerPluginsTab.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetCompilerPluginsTab.kt @@ -62,8 +62,8 @@ class KotlinFacetCompilerPluginsTab( override fun getColumnCount() = 2 override fun getColumnName(column: Int) = when (column) { - 0 -> "Plugin" - else -> "Options" + 0 -> KotlinFacetBundle.message("column.name.plugin") + else -> KotlinFacetBundle.message("column.name.options") } override fun getColumnClass(columnIndex: Int) = String::class.java @@ -118,7 +118,8 @@ class KotlinFacetCompilerPluginsTab( val invalidOptions = optionsByTable.filter { parsePluginOption(it) == null } if (invalidOptions.isNotEmpty()) { val message = buildString { - append("Following options are not correct:
") + append(KotlinFacetBundle.message("text.following.options.are.not.correct")) + append("
") invalidOptions.joinTo(this, "
") { "$it" } } return ValidationResult(message) @@ -140,7 +141,7 @@ class KotlinFacetCompilerPluginsTab( validatorsManager.registerValidator(OptionValidator()) } - override fun getDisplayName() = "Compiler Plugins" + override fun getDisplayName() = KotlinFacetBundle.message("name.compiler.plugins") override fun createComponent(): JComponent { val panel = JPanel(BorderLayout()) diff --git a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt index 6c7ed00323e..e6df077f8c3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt +++ b/idea/src/org/jetbrains/kotlin/idea/facet/KotlinFacetEditorGeneralTab.kt @@ -82,10 +82,11 @@ class KotlinFacetEditorGeneralTab( private fun FormBuilder.addTargetPlatformComponents(): FormBuilder { return if (configuration?.settings?.isHmppEnabled == true) { - targetPlatformLabel.toolTipText = "The project is imported from external build system and could not be edited" - this.addLabeledComponent("Selected target platforms:", targetPlatformLabel) + targetPlatformLabel.toolTipText = + KotlinFacetBundle.message("label.text.the.project.is.imported.from.external.build.system.and.could.not.be.edited") + this.addLabeledComponent(KotlinFacetBundle.message("label.text.selected.target.platforms"), targetPlatformLabel) } else { - this.addLabeledComponent("&Target platform: ", targetPlatformSelectSingleCombobox) + this.addLabeledComponent(KotlinFacetBundle.message("label.text.target.platform"), targetPlatformSelectSingleCombobox) } } @@ -131,7 +132,7 @@ class KotlinFacetEditorGeneralTab( isMultiEditor ) - useProjectSettingsCheckBox = ThreeStateCheckBox("Use project settings").apply { isThirdStateEnabled = isMultiEditor } + useProjectSettingsCheckBox = ThreeStateCheckBox(KotlinFacetBundle.message("checkbox.text.use.project.settings")).apply { isThirdStateEnabled = isMultiEditor } dependsOnLabel = JLabel() targetPlatformWrappers = CommonPlatforms.allDefaultTargetPlatforms.sortedBy { unifyJvmVersion(it.oldFashionedDescription) } @@ -151,14 +152,14 @@ class KotlinFacetEditorGeneralTab( text = (value as? TargetPlatformWrapper)?.targetPlatform?.componentPlatforms?.singleOrNull() ?.oldFashionedDescription - ?: "Multiplatform" + ?: KotlinFacetBundle.message("text.multiplatform") } } }) } targetPlatformSelectSingleCombobox.maximumRowCount = targetPlatformsComboboxRowsCount(targetPlatformWrappers.size) - projectSettingsLink = HoverHyperlinkLabel("Edit project settings").apply { + projectSettingsLink = HoverHyperlinkLabel(KotlinFacetBundle.message("link.text.edit.project.settings")).apply { addHyperlinkListener { ShowSettingsUtilImpl.showSettingsDialog(project, compilerConfigurable.id, "") if (useProjectSettingsCheckBox.isSelected) { @@ -223,7 +224,7 @@ class KotlinFacetEditorGeneralTab( inner class ArgumentConsistencyValidator : FacetEditorValidator() { override fun check(): ValidationResult { - val platform = editor.getChosenPlatform() ?: return ValidationResult("At least one target platform should be selected") + val platform = editor.getChosenPlatform() ?: return ValidationResult(KotlinFacetBundle.message("error.text.at.least.one.target.platform.should.be.selected")) val primaryArguments = platform.createArguments { editor.compilerConfigurable.applyTo( this, @@ -259,13 +260,18 @@ class KotlinFacetEditorGeneralTab( if (overridingArguments.isNotEmpty() || redundantArguments.isNotEmpty()) { val message = buildString { if (overridingArguments.isNotEmpty()) { - append("Following arguments override facet settings: ${overridingArguments.joinToString()}") + append( + KotlinFacetBundle.message( + "text.following.arguments.override.facet.settings", + overridingArguments.joinToString() + ) + ) } if (redundantArguments.isNotEmpty()) { if (isNotEmpty()) { append("
") } - append("Following arguments are redundant: ${redundantArguments.joinToString()}") + append(KotlinFacetBundle.message("text.following.arguments.are.redundant", redundantArguments.joinToString())) } } return ValidationResult(message) @@ -425,7 +431,7 @@ class KotlinFacetEditorGeneralTab( } } - override fun getDisplayName() = "General" + override fun getDisplayName() = KotlinFacetBundle.message("name.general") override fun createComponent(): JComponent { return editor