i18n: add bundle for idea/configuration

This commit is contained in:
Dmitry Gridin
2020-02-20 17:32:28 +07:00
parent ddd6f81581
commit 2da27a9e6a
12 changed files with 204 additions and 93 deletions
@@ -140,10 +140,7 @@ kotlin.compiler.js.option.panel.title=Kotlin to JavaScript
kotlin.compiler.js.option.generate.sourcemaps=Generate &source maps
kotlin.compiler.js.option.output.prefix=File to &prepend to generated code:
kotlin.compiler.js.option.output.postfix=File to append to generated c&ode:
kotlin.compiler.js.option.output.prefix.browse.title=Choose file to prepend to generated code
kotlin.compiler.js.option.output.postfix.browse.title=Choose file to append to generated code
kotlin.compiler.js.option.output.copy.files=&Copy library runtime files
kotlin.compiler.js.option.output.copy.dir=O&utput directory for library &runtime files:
kotlin.compiler.js.option.output.copy.files=&Copy library runtime fileskotlin.compiler.js.option.output.copy.dir=O&utput directory for library &runtime files:
# Android Lint
android.klint.inspections.group.name=Android Lint for Kotlin
@@ -0,0 +1,46 @@
action.text.ignore=Ignore
action.text.update=Update
description.always=Always
description.amd=AMD
description.commonjs=CommonJS
description.never=Never
description.plain.put.to.global.scope=Plain (put to global scope)
description.umd.detect.amd.or.commonjs.if.available.fallback.to.plain=UMD (detect AMD or CommonJS if available, fallback to plain)
description.when.inlining.a.function.from.other.module.with.embedded.sources=When inlining a function from other module with embedded sources
error.text.shouldn.t.add.null.urls.to.custom.repositories=Shouldn''t add null urls to custom repositories
feature.text.new.experimental.project.wizard=New Kotlin project wizard
feature.text.new.java.to.kotlin.converter=New Java to Kotlin converter
message.enter.fully.qualified.method.name=Enter fully-qualified method name:
message.text.a.new.version.is.available=A new version {0} is available
message.text.a.new.version.is.found=A new version {0} is found but it''s not verified by {1}.
message.text.update.check.failed=Update check failed: {0}
message.text.you.have.the.latest.version.of.the.plugin.installed=You have the latest version of the plugin installed.
message.verifier.disabled=(verifier disabled)
migration.text.api.version=API version: {0} -> {1}
migration.text.detected.migration=Detected migration:
migration.text.language.version=Language version: {0} -> {1}
migration.text.migrations.for.kotlin.code.are.available=Migrations for Kotlin code are available
migration.text.run.migrations=Run migrations
migration.text.standard.library=Standard library: {0} -> {1}
migration.title.kotlin.migration=Kotlin Migration
name.kotlin.compiler=Kotlin Compiler
name.kotlin=Kotlin
name.method=Method
status.text.installation.failed=Installation failed
status.text.installing=Installing...
text.add.exclusion=Add exclusion
text.and=and
text.other.s=other(s)
text.patched.original={0} (Patched! Original: {1})
text.the.compiler.bundled.to.kotlin.plugin=The compiler bundled to Kotlin plugin ({0}) is older than external compiler used for building modules:
text.this.may.cause.different.set.of.errors.and.warnings.reported.in.ide.p=This may cause different set of errors and warnings reported in IDE.
title.choose.output.directory=Choose Output Directory
title.early.access.preview.1.3.x=Early Access Preview 1.3.x
title.early.access.preview.1.4.x=Early Access Preview 1.4.x
title.edit.exclusion=Edit exclusion
title.kotlin.compiler.js.option.output.postfix.browse.title=Choose file to append to generated code
title.kotlin.compiler.js.option.output.prefix.browse.title=Choose file to prepend to generated code
title.outdated.bundled.kotlin.compiler=Outdated Bundled Kotlin Compiler
title.stable=Stable
warning.text.following.modules.override.project.settings=Following modules override project settings:
warning.text.modules.override.project.settings={0} modules override project settings
@@ -9,7 +9,6 @@ import com.intellij.icons.AllIcons;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
@@ -33,8 +32,8 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
import org.jetbrains.kotlin.config.*;
import org.jetbrains.kotlin.idea.KotlinBundle;
import org.jetbrains.kotlin.idea.PluginStartupService;
import org.jetbrains.kotlin.idea.configuration.KotlinConfigurationBundle;
import org.jetbrains.kotlin.idea.facet.DescriptionListCellRenderer;
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
import org.jetbrains.kotlin.idea.project.NewInferenceForIDEAnalysisComponent;
@@ -43,12 +42,11 @@ import org.jetbrains.kotlin.idea.util.CidrUtil;
import org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt;
import org.jetbrains.kotlin.platform.IdePlatformKind;
import org.jetbrains.kotlin.platform.PlatformUtilKt;
import org.jetbrains.kotlin.platform.TargetPlatform;
import org.jetbrains.kotlin.platform.impl.JsIdePlatformUtil;
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformKind;
import org.jetbrains.kotlin.platform.impl.JvmIdePlatformUtil;
import org.jetbrains.kotlin.config.JvmTarget;
import org.jetbrains.kotlin.platform.jvm.JdkPlatform;
import org.jetbrains.kotlin.platform.TargetPlatform;
import javax.swing.*;
import java.util.*;
@@ -62,15 +60,19 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
private static final int MAX_WARNING_SIZE = 75;
static {
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_PLAIN, "Plain (put to global scope)");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_AMD, "AMD");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_COMMONJS, "CommonJS");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_UMD, "UMD (detect AMD or CommonJS if available, fallback to plain)");
moduleKindDescriptions
.put(K2JsArgumentConstants.MODULE_PLAIN, KotlinConfigurationBundle.message("description.plain.put.to.global.scope"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_AMD, KotlinConfigurationBundle.message("description.amd"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_COMMONJS, KotlinConfigurationBundle.message("description.commonjs"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_UMD, KotlinConfigurationBundle
.message("description.umd.detect.amd.or.commonjs.if.available.fallback.to.plain"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, "Never");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, "Always");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING,
"When inlining a function from other module with embedded sources");
soruceMapSourceEmbeddingDescriptions
.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, KotlinConfigurationBundle.message("description.never"));
soruceMapSourceEmbeddingDescriptions
.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, KotlinConfigurationBundle.message("description.always"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING, KotlinConfigurationBundle
.message("description.when.inlining.a.function.from.other.module.with.embedded.sources"));
}
@Nullable
@@ -189,13 +191,13 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
private void initializeNonCidrSettings(boolean isMultiEditor) {
setupFileChooser(labelForOutputPrefixFile, outputPrefixFile,
KotlinBundle.message("kotlin.compiler.js.option.output.prefix.browse.title"),
KotlinConfigurationBundle.message("title.kotlin.compiler.js.option.output.prefix.browse.title"),
true);
setupFileChooser(labelForOutputPostfixFile, outputPostfixFile,
KotlinBundle.message("kotlin.compiler.js.option.output.postfix.browse.title"),
KotlinConfigurationBundle.message("title.kotlin.compiler.js.option.output.postfix.browse.title"),
true);
setupFileChooser(labelForOutputDirectory, outputDirectory,
"Choose Output Directory",
KotlinConfigurationBundle.message("title.choose.output.directory"),
false);
fillModuleKindList();
@@ -233,11 +235,12 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
int nameCountToShow = calculateNameCountToShowInWarning(modulesOverridingProjectSettings);
int allNamesCount = modulesOverridingProjectSettings.size();
if (nameCountToShow == 0) {
return String.valueOf(allNamesCount) + " modules override project settings";
return KotlinConfigurationBundle.message("warning.text.modules.override.project.settings", String.valueOf(allNamesCount));
}
StringBuilder builder = new StringBuilder();
builder.append("<html>Following modules override project settings: ");
builder.append("<html>");
builder.append(KotlinConfigurationBundle.message("warning.text.following.modules.override.project.settings")).append(" ");
CollectionsKt.joinTo(
modulesOverridingProjectSettings.subList(0, nameCountToShow),
builder,
@@ -254,7 +257,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
}
);
if (nameCountToShow < allNamesCount) {
builder.append(" and ").append(allNamesCount - nameCountToShow).append(" other(s)");
builder.append(" ").append(KotlinConfigurationBundle.message("text.and")).append(" ").append(allNamesCount - nameCountToShow)
.append(" ").append(KotlinConfigurationBundle.message("text.other.s"));
}
return builder.toString();
}
@@ -503,10 +507,14 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
LanguageFeature.State state = (LanguageFeature.State) coroutineSupportComboBox.getSelectedItem();
if (state == null) return CommonCompilerArguments.DEFAULT;
switch (state) {
case ENABLED: return CommonCompilerArguments.ENABLE;
case ENABLED_WITH_WARNING: return CommonCompilerArguments.WARN;
case ENABLED_WITH_ERROR: return CommonCompilerArguments.ERROR;
default: return CommonCompilerArguments.DEFAULT;
case ENABLED:
return CommonCompilerArguments.ENABLE;
case ENABLED_WITH_WARNING:
return CommonCompilerArguments.WARN;
case ENABLED_WITH_ERROR:
return CommonCompilerArguments.ERROR;
default:
return CommonCompilerArguments.DEFAULT;
}
}
@@ -567,7 +575,8 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
k2jsCompilerArguments.setModuleKind(getSelectedModuleKind());
k2jsCompilerArguments.setSourceMapPrefix(sourceMapPrefix.getText());
k2jsCompilerArguments.setSourceMapEmbedSources(generateSourceMapsCheckBox.isSelected() ? getSelectedSourceMapSourceEmbedding() : null);
k2jsCompilerArguments
.setSourceMapEmbedSources(generateSourceMapsCheckBox.isSelected() ? getSelectedSourceMapSourceEmbedding() : null);
k2jvmCompilerArguments.setJvmTarget(getSelectedJvmVersion());
@@ -627,7 +636,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
@Nls
@Override
public String getDisplayName() {
return "Kotlin Compiler";
return KotlinConfigurationBundle.message("name.kotlin.compiler");
}
@Nullable
@@ -33,8 +33,8 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
import org.jetbrains.kotlin.config.*;
import org.jetbrains.kotlin.idea.KotlinBundle;
import org.jetbrains.kotlin.idea.PluginStartupComponent;
import org.jetbrains.kotlin.idea.configuration.KotlinConfigurationBundle;
import org.jetbrains.kotlin.idea.facet.DescriptionListCellRenderer;
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
import org.jetbrains.kotlin.idea.project.NewInferenceForIDEAnalysisComponent;
@@ -62,15 +62,14 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
private static final int MAX_WARNING_SIZE = 75;
static {
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_PLAIN, "Plain (put to global scope)");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_AMD, "AMD");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_COMMONJS, "CommonJS");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_UMD, "UMD (detect AMD or CommonJS if available, fallback to plain)");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_PLAIN, KotlinConfigurationBundle.message("description.plain.put.to.global.scope"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_AMD, KotlinConfigurationBundle.message("description.amd"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_COMMONJS, KotlinConfigurationBundle.message("description.commonjs"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_UMD, KotlinConfigurationBundle.message("description.umd.detect.amd.or.commonjs.if.available.fallback.to.plain"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, "Never");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, "Always");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING,
"When inlining a function from other module with embedded sources");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, KotlinConfigurationBundle.message("description.never"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, KotlinConfigurationBundle.message("description.always"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING, KotlinConfigurationBundle.message("description.when.inlining.a.function.from.other.module.with.embedded.sources"));
}
@Nullable
@@ -189,13 +188,13 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
private void initializeNonCidrSettings(boolean isMultiEditor) {
setupFileChooser(labelForOutputPrefixFile, outputPrefixFile,
KotlinBundle.message("kotlin.compiler.js.option.output.prefix.browse.title"),
KotlinConfigurationBundle.message("title.kotlin.compiler.js.option.output.prefix.browse.title"),
true);
setupFileChooser(labelForOutputPostfixFile, outputPostfixFile,
KotlinBundle.message("kotlin.compiler.js.option.output.postfix.browse.title"),
KotlinConfigurationBundle.message("title.kotlin.compiler.js.option.output.postfix.browse.title"),
true);
setupFileChooser(labelForOutputDirectory, outputDirectory,
"Choose Output Directory",
KotlinConfigurationBundle.message("title.choose.output.directory"),
false);
fillModuleKindList();
@@ -233,11 +232,12 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
int nameCountToShow = calculateNameCountToShowInWarning(modulesOverridingProjectSettings);
int allNamesCount = modulesOverridingProjectSettings.size();
if (nameCountToShow == 0) {
return String.valueOf(allNamesCount) + " modules override project settings";
return KotlinConfigurationBundle.message("warning.text.modules.override.project.settings", String.valueOf(allNamesCount));
}
StringBuilder builder = new StringBuilder();
builder.append("<html>Following modules override project settings: ");
builder.append("<html>");
builder.append(KotlinConfigurationBundle.message("warning.text.following.modules.override.project.settings")).append(" ");
CollectionsKt.joinTo(
modulesOverridingProjectSettings.subList(0, nameCountToShow),
builder,
@@ -254,7 +254,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
}
);
if (nameCountToShow < allNamesCount) {
builder.append(" and ").append(allNamesCount - nameCountToShow).append(" other(s)");
builder.append(" ").append(KotlinConfigurationBundle.message("text.and")).append(" ").append(allNamesCount - nameCountToShow).append(" ").append(KotlinConfigurationBundle.message("text.other.s"));
}
return builder.toString();
}
@@ -627,7 +627,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
@Nls
@Override
public String getDisplayName() {
return "Kotlin Compiler";
return KotlinConfigurationBundle.message("name.kotlin.compiler");
}
@Nullable
@@ -33,8 +33,9 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments;
import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
import org.jetbrains.kotlin.config.*;
import org.jetbrains.kotlin.idea.KotlinBundle;
import org.jetbrains.kotlin.idea.PluginStartupComponent;
import org.jetbrains.kotlin.idea.configuration.ProjectUtilsKt;
import org.jetbrains.kotlin.idea.configuration.KotlinConfigurationBundle;
import org.jetbrains.kotlin.idea.facet.DescriptionListCellRenderer;
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
import org.jetbrains.kotlin.idea.project.NewInferenceForIDEAnalysisComponent;
@@ -62,15 +63,14 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
private static final int MAX_WARNING_SIZE = 75;
static {
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_PLAIN, "Plain (put to global scope)");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_AMD, "AMD");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_COMMONJS, "CommonJS");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_UMD, "UMD (detect AMD or CommonJS if available, fallback to plain)");
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_PLAIN, KotlinConfigurationBundle.message("description.plain.put.to.global.scope"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_AMD, KotlinConfigurationBundle.message("description.amd"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_COMMONJS, KotlinConfigurationBundle.message("description.commonjs"));
moduleKindDescriptions.put(K2JsArgumentConstants.MODULE_UMD, KotlinConfigurationBundle.message("description.umd.detect.amd.or.commonjs.if.available.fallback.to.plain"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, "Never");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, "Always");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING,
"When inlining a function from other module with embedded sources");
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_NEVER, KotlinConfigurationBundle.message("description.never"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_ALWAYS, KotlinConfigurationBundle.message("description.always"));
soruceMapSourceEmbeddingDescriptions.put(K2JsArgumentConstants.SOURCE_MAP_SOURCE_CONTENT_INLINING, KotlinConfigurationBundle.message("description.when.inlining.a.function.from.other.module.with.embedded.sources"));
}
@Nullable
@@ -189,13 +189,13 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
private void initializeNonCidrSettings(boolean isMultiEditor) {
setupFileChooser(labelForOutputPrefixFile, outputPrefixFile,
KotlinBundle.message("kotlin.compiler.js.option.output.prefix.browse.title"),
KotlinConfigurationBundle.message("title.kotlin.compiler.js.option.output.prefix.browse.title"),
true);
setupFileChooser(labelForOutputPostfixFile, outputPostfixFile,
KotlinBundle.message("kotlin.compiler.js.option.output.postfix.browse.title"),
KotlinConfigurationBundle.message("title.kotlin.compiler.js.option.output.postfix.browse.title"),
true);
setupFileChooser(labelForOutputDirectory, outputDirectory,
"Choose Output Directory",
KotlinConfigurationBundle.message("title.choose.output.directory"),
false);
fillModuleKindList();
@@ -233,11 +233,12 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
int nameCountToShow = calculateNameCountToShowInWarning(modulesOverridingProjectSettings);
int allNamesCount = modulesOverridingProjectSettings.size();
if (nameCountToShow == 0) {
return String.valueOf(allNamesCount) + " modules override project settings";
return KotlinConfigurationBundle.message("warning.text.modules.override.project.settings", String.valueOf(allNamesCount));
}
StringBuilder builder = new StringBuilder();
builder.append("<html>Following modules override project settings: ");
builder.append("<html>");
builder.append(KotlinConfigurationBundle.message("warning.text.following.modules.override.project.settings")).append(" ");
CollectionsKt.joinTo(
modulesOverridingProjectSettings.subList(0, nameCountToShow),
builder,
@@ -254,7 +255,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
}
);
if (nameCountToShow < allNamesCount) {
builder.append(" and ").append(allNamesCount - nameCountToShow).append(" other(s)");
builder.append(" ").append(KotlinConfigurationBundle.message("text.and")).append(" ").append(allNamesCount - nameCountToShow).append(" ").append(KotlinConfigurationBundle.message("text.other.s"));
}
return builder.toString();
}
@@ -627,7 +628,7 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable {
@Nls
@Override
public String getDisplayName() {
return "Kotlin Compiler";
return KotlinConfigurationBundle.message("name.kotlin.compiler");
}
@Nullable
@@ -20,13 +20,13 @@ import javax.swing.JPanel
object ExperimentalFeatures {
val NewJ2k = RegistryExperimentalFeature(
title = "New Java to Kotlin converter",
title = KotlinConfigurationBundle.message("feature.text.new.java.to.kotlin.converter"),
registryKey = "kotlin.experimental.new.j2k",
enabledByDefault = true
)
val NewWizard = object : RegistryExperimentalFeature(
title = "New Kotlin project wizard",
title = KotlinConfigurationBundle.message("feature.text.new.experimental.project.wizard"),
registryKey = "kotlin.experimental.project.wizard",
enabledByDefault = false
) {
@@ -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.configuration
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.util.AbstractKotlinBundle
@NonNls
private const val BUNDLE = "messages.KotlinConfigurationBundle"
object KotlinConfigurationBundle : AbstractKotlinBundle(BUNDLE) {
@JvmStatic
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
}
@@ -28,17 +28,20 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
UpdateChannel.values().find { it.ordinal == channelOrdinal }?.let { eapChannel ->
if (eapChannel != UpdateChannel.STABLE) {
hosts.add(eapChannel.url ?: error("Shouldn't add null urls to custom repositories"))
hosts.add(eapChannel.url ?: error(KotlinConfigurationBundle.message("error.text.shouldn.t.add.null.urls.to.custom.repositories")))
}
}
}
enum class UpdateChannel(val url: String?, val title: String) {
STABLE(null, "Stable"),
EAP("https://plugins.jetbrains.com/plugins/eap/${KotlinPluginUtil.KOTLIN_PLUGIN_ID.idString}", "Early Access Preview 1.3.x"),
STABLE(null, KotlinConfigurationBundle.message("title.stable")),
EAP(
"https://plugins.jetbrains.com/plugins/eap/${KotlinPluginUtil.KOTLIN_PLUGIN_ID.idString}",
KotlinConfigurationBundle.message("title.early.access.preview.1.3.x")
),
EAP_NEXT(
"https://plugins.jetbrains.com/plugins/eap-next/${KotlinPluginUtil.KOTLIN_PLUGIN_ID.idString}",
"Early Access Preview 1.4.x"
KotlinConfigurationBundle.message("title.early.access.preview.1.4.x")
);
fun isInHosts(): Boolean {
@@ -60,7 +63,7 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
override fun getId(): String = ID
override fun getDisplayName(): String = "Kotlin"
override fun getDisplayName(): String = KotlinConfigurationBundle.message("name.kotlin")
override fun isModified() =
form.experimentalFeaturesPanel.isModified()
@@ -89,7 +92,7 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
update?.let {
form.hideInstallButton()
setInstalledVersion(it.pluginDescriptor.version, "Installing...")
setInstalledVersion(it.pluginDescriptor.version, KotlinConfigurationBundle.message("status.text.installing"))
form.installStatusLabel.text = installingStatus
@@ -111,7 +114,7 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
},
errorCallback = {
if (versionForInstallation == it.pluginDescriptor.version) {
form.installStatusLabel.text = "Installation failed"
form.installStatusLabel.text = KotlinConfigurationBundle.message("status.text.installation.failed")
form.showInstallButton()
setInstalledVersion(null, null)
}
@@ -150,7 +153,7 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
when (pluginUpdateStatus) {
PluginUpdateStatus.LatestVersionInstalled -> {
form.setUpdateStatus(
"You have the latest version of the plugin installed.",
KotlinConfigurationBundle.message("message.text.you.have.the.latest.version.of.the.plugin.installed"),
false
)
}
@@ -158,7 +161,13 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
is PluginUpdateStatus.Update -> {
update = pluginUpdateStatus
versionForInstallation = update?.pluginDescriptor?.version
form.setUpdateStatus("A new version ${pluginUpdateStatus.pluginDescriptor.version} is available", true)
form.setUpdateStatus(
KotlinConfigurationBundle.message(
"message.text.a.new.version.is.available",
pluginUpdateStatus.pluginDescriptor.version
),
true
)
if (installedVersion != null && installedVersion == versionForInstallation) {
// Installation of the plugin has been started or finished
form.hideInstallButton()
@@ -167,11 +176,18 @@ class KotlinLanguageConfiguration : SearchableConfigurable, Configurable.NoScrol
}
is PluginUpdateStatus.CheckFailed ->
form.setUpdateStatus("Update check failed: ${pluginUpdateStatus.message}", false)
form.setUpdateStatus(
KotlinConfigurationBundle.message("message.text.update.check.failed", pluginUpdateStatus.message),
false
)
is PluginUpdateStatus.Unverified -> {
val version = pluginUpdateStatus.updateStatus.pluginDescriptor.version
val generalLine = "A new version $version is found but it's not verified by ${pluginUpdateStatus.verifierName}."
val generalLine = KotlinConfigurationBundle.message(
"message.text.a.new.version.is.found",
version,
pluginUpdateStatus.verifierName
)
val reasonLine = pluginUpdateStatus.reason ?: ""
val message = "<html>$generalLine<br/>$reasonLine</html>"
form.setUpdateStatus(message, false)
@@ -45,8 +45,11 @@ fun notifyOutdatedBundledCompilerIfNecessary(project: Project) {
Notifications.Bus.notify(
Notification(
OUTDATED_BUNDLED_COMPILER_GROUP_DISPLAY_ID, OUTDATED_BUNDLED_COMPILER_GROUP_DISPLAY_ID, message,
NotificationType.WARNING, NotificationListener { notification, event ->
OUTDATED_BUNDLED_COMPILER_GROUP_DISPLAY_ID,
KotlinConfigurationBundle.message("title.outdated.bundled.kotlin.compiler"),
message,
NotificationType.WARNING,
NotificationListener { notification, event ->
if (event.eventType == HyperlinkEvent.EventType.ACTIVATED) {
when {
"update" == event.description -> {
@@ -127,10 +130,10 @@ fun createOutdatedBundledCompilerMessage(project: Project, bundledCompilerVersio
modulesStr = modulesStr.removeSuffix("<br/>")
return """
<p>The compiler bundled to Kotlin plugin ($bundledCompilerVersion) is older than external compiler used for building modules:</p>
<p>${KotlinConfigurationBundle.message("text.the.compiler.bundled.to.kotlin.plugin", bundledCompilerVersion)}</p>
<ul>$modulesStr</ul>
<p>This may cause different set of errors and warnings reported in IDE.</p>
<p><a href="update">Update</a> <a href="ignore">Ignore</a></p>"""
<p>${KotlinConfigurationBundle.message("text.this.may.cause.different.set.of.errors.and.warnings.reported.in.ide.p")}</p>
<p><a href="update">${KotlinConfigurationBundle.message("action.text.update")}</a> <a href="ignore">${KotlinConfigurationBundle.message("action.text.ignore")}</a></p>"""
.trimIndent().lines().joinToString(separator = "").replace("<br/>", "\n")
}
@@ -196,4 +199,4 @@ private fun createKotlinVersion(versionStr: String): KotlinVersion? {
private const val NUMBER_OF_MODULES_TO_SHOW = 2
private const val SUPPRESSED_OUTDATED_COMPILER_PROPERTY_NAME = "outdated.bundled.kotlin.compiler"
private const val OUTDATED_BUNDLED_COMPILER_GROUP_DISPLAY_ID = "Outdated Bundled Kotlin Compiler"
private const val OUTDATED_BUNDLED_COMPILER_GROUP_DISPLAY_ID = "Outdated Bundled Kotlin Compiler"
@@ -11,6 +11,7 @@ import com.intellij.util.ui.AsyncProcessIcon;
import org.jetbrains.kotlin.idea.KotlinPluginUtil;
import org.jetbrains.kotlin.idea.PlatformVersion;
import org.jetbrains.kotlin.idea.configuration.ExperimentalFeaturesPanel;
import org.jetbrains.kotlin.idea.configuration.KotlinConfigurationBundle;
import org.jetbrains.kotlin.idea.util.VersioningKt;
import javax.swing.*;
@@ -40,7 +41,7 @@ public class KotlinLanguageConfigurationForm {
if (KotlinPluginUtil.isPatched()) {
@SuppressWarnings("deprecation")
String pluginVersionFromIdea = KotlinPluginUtil.getPluginVersionFromIdea();
currentVersion.setText(pluginVersion + " (Patched! Original: " + pluginVersionFromIdea + ")");
currentVersion.setText(KotlinConfigurationBundle.message("text.patched.original", pluginVersion, pluginVersionFromIdea));
} else {
currentVersion.setText(pluginVersion);
}
@@ -106,7 +107,7 @@ public class KotlinLanguageConfigurationForm {
private void showVerifierDisabledStatus() {
//noinspection UnresolvedPropertyKey
if (!Registry.is("kotlin.plugin.update.verifier.enabled", true)) {
verifierDisabledText.setText("(verifier disabled)");
verifierDisabledText.setText(KotlinConfigurationBundle.message("message.verifier.disabled"));
}
else {
verifierDisabledText.setText("");
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.configuration.ui
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.ui.NonEmptyInputValidator
import com.intellij.ui.AddEditRemovePanel
import org.jetbrains.kotlin.idea.configuration.KotlinConfigurationBundle
import org.jetbrains.kotlin.name.FqNameUnsafe
class NotPropertyListPanel(data: MutableList<FqNameUnsafe>) : AddEditRemovePanel<FqNameUnsafe>(MyTableModel(), data) {
@@ -21,8 +22,8 @@ class NotPropertyListPanel(data: MutableList<FqNameUnsafe>) : AddEditRemovePanel
override fun editItem(fqName: FqNameUnsafe): FqNameUnsafe? {
val result = Messages.showInputDialog(
this, "Enter fully-qualified method name:",
"Edit exclusion",
this, KotlinConfigurationBundle.message("message.enter.fully.qualified.method.name"),
KotlinConfigurationBundle.message("title.edit.exclusion"),
Messages.getQuestionIcon(),
fqName.asString(),
NonEmptyInputValidator()
@@ -39,8 +40,8 @@ class NotPropertyListPanel(data: MutableList<FqNameUnsafe>) : AddEditRemovePanel
override fun addItem(): FqNameUnsafe? {
val result = Messages.showInputDialog(
this, "Enter fully-qualified method name:",
"Add exclusion",
this, KotlinConfigurationBundle.message("message.enter.fully.qualified.method.name"),
KotlinConfigurationBundle.message("text.add.exclusion"),
Messages.getQuestionIcon(),
"",
NonEmptyInputValidator()
@@ -57,7 +58,7 @@ class NotPropertyListPanel(data: MutableList<FqNameUnsafe>) : AddEditRemovePanel
class MyTableModel : AddEditRemovePanel.TableModel<FqNameUnsafe>() {
override fun getField(o: FqNameUnsafe, columnIndex: Int) = o.asString()
override fun getColumnName(columnIndex: Int) = "Method"
override fun getColumnName(columnIndex: Int) = KotlinConfigurationBundle.message("name.method")
override fun getColumnCount() = 1
}
}
@@ -9,34 +9,53 @@ import com.intellij.notification.*
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.impl.SimpleDataContext
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.idea.configuration.KotlinConfigurationBundle
import org.jetbrains.kotlin.idea.configuration.MigrationInfo
import org.jetbrains.kotlin.idea.migration.CodeMigrationAction
internal fun showMigrationNotification(project: Project, migrationInfo: MigrationInfo) {
val detectedChangeMessage = buildString {
appendBr("Detected migration:")
appendBr(KotlinConfigurationBundle.message("migration.text.detected.migration"))
if (migrationInfo.oldStdlibVersion != migrationInfo.newStdlibVersion) {
appendIndentBr("Standard library: ${migrationInfo.oldStdlibVersion} -> ${migrationInfo.newStdlibVersion}")
appendIndentBr(
KotlinConfigurationBundle.message(
"migration.text.standard.library",
migrationInfo.oldStdlibVersion,
migrationInfo.newStdlibVersion
)
)
}
if (migrationInfo.oldLanguageVersion != migrationInfo.newLanguageVersion) {
appendIndentBr("Language version: ${migrationInfo.oldLanguageVersion} -> ${migrationInfo.newLanguageVersion}")
appendIndentBr(
KotlinConfigurationBundle.message(
"migration.text.language.version",
migrationInfo.oldLanguageVersion,
migrationInfo.newLanguageVersion
)
)
}
if (migrationInfo.oldApiVersion != migrationInfo.newApiVersion) {
appendIndentBr("API version: ${migrationInfo.oldApiVersion} -> ${migrationInfo.newApiVersion}")
appendIndentBr(
KotlinConfigurationBundle.message(
"migration.text.api.version",
migrationInfo.oldApiVersion,
migrationInfo.newApiVersion
)
)
}
}
KOTLIN_MIGRATION_NOTIFICATION_GROUP
.createNotification(
KOTLIN_MIGRATION_NOTIFICATION_ID,
"Migrations for Kotlin code are available<br/><br/>$detectedChangeMessage",
KotlinConfigurationBundle.message("migration.title.kotlin.migration"),
"${KotlinConfigurationBundle.message("migration.text.migrations.for.kotlin.code.are.available")}<br/><br/>$detectedChangeMessage",
NotificationType.WARNING,
null
)
.also { notification ->
notification.addAction(NotificationAction.createSimple("Run migrations") {
notification.addAction(NotificationAction.createSimple(KotlinConfigurationBundle.message("migration.text.run.migrations")) {
val projectContext = SimpleDataContext.getProjectContext(project)
val action = ActionManager.getInstance().getAction(CodeMigrationAction.ACTION_ID)
Notification.fire(notification, action, projectContext)