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