diff --git a/idea/resources/messages/KotlinBundle.properties b/idea/resources/messages/KotlinBundle.properties index 33018848397..f5565dce1fe 100644 --- a/idea/resources/messages/KotlinBundle.properties +++ b/idea/resources/messages/KotlinBundle.properties @@ -1821,4 +1821,56 @@ expression=Expression statement=Statement class=Class object.declaration=Object declaration -top.level=Top-level \ No newline at end of file +top.level=Top-level +analyse.modules.with.different.platforms.together=Analyse modules with different platforms together +toggle.composite.analysis.mode.for.multiplatform=Toggle composite analysis mode for multiplatform +rethrow.stored.pce.as.a.new.runtime.exception=Rethrow stored PCE as a new runtime exception +internal.toggle.throwing.cached.pce=Internal: toggle throwing cached PCE +minimal.line.count=Minimal line count +files.to.visit=Files to visit +random.seed=Random seed +number.of.attempts.then.files.in.project.0=Number of attempts > then files in project, {0} +text.done=Done +file.lines=File lines +max.functions.to.visit=Max functions to visit +move.refactoring.testing=Move refactoring testing +compiling.project=Compiling project... +saving.files=Saving files... +perform.refactoring=Perform refactoring ... +update.indices=Update indices... +reset.files=Reset files... +cannot.get.or.create.results.file=Cannot get or create results file +cannot.get.project.root.directory=Cannot get project root directory +0.try.1.with.2.fails.and.3.verifications={0} [Try {1} with {2} fails and {3} verifications] +test.result.log.file.will.be.placed.here=Test result log file will be placed here +maximum.count.of.applied.refactoring.before.validity.check=Maximum count of applied refactoring before validity check +move.refactoring.test=Move refactoring test +resolve.pasted.references=resolve pasted references +create.kotlin.file=Create Kotlin file +type.alias.0=Type alias "{0}" +type.parameter.0=Type parameter "{0}" +parameter.0=Parameter "{0}" +property.0=Property "{0}" +function.01=Function "{0}" +object.0=Object "{0}" +interface=Interface +constructor=Constructor +implicit.nothing.type=Implicit `Nothing?` type +move.suspicious.callable.reference.into.parentheses=Move suspicious callable reference into parentheses '()' +local.variable=Local variable +const.property=Const property +private.property=Private property +object.or.top.level.property=Object or top-level property +property=Property +test.function=Test function +function=Function +enum.entry=Enum entry +create.subclass=Create subclass +implement.sealed.class=Implement sealed class +implement.abstract.class=Implement abstract class +implement.interface=Implement interface +implement.abstract.function=Implement abstract function +implement.abstract.property=Implement abstract property +replace.explicit.lambda.parameter.with.it=Replace explicit lambda parameter with 'it' +create.test=Create test +convert.class.0.to.kotlin=Convert class ''{0}'' to Kotlin \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/MultiplatformCompositeAnalysisModeToggleAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/MultiplatformCompositeAnalysisModeToggleAction.kt index b9e2a4d6e05..085f377792f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/MultiplatformCompositeAnalysisModeToggleAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/MultiplatformCompositeAnalysisModeToggleAction.kt @@ -7,12 +7,17 @@ package org.jetbrains.kotlin.idea.actions.internal import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.ToggleAction +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.project.KotlinMultiplatformAnalysisModeComponent import org.jetbrains.kotlin.idea.project.KotlinMultiplatformAnalysisModeComponent.Mode import org.jetbrains.kotlin.idea.project.useCompositeAnalysis class MultiplatformCompositeAnalysisToggleAction : - ToggleAction("Toggle composite analysis mode for multiplatform", "Analyse modules with different platforms together", null) { + ToggleAction( + KotlinBundle.message("toggle.composite.analysis.mode.for.multiplatform"), + KotlinBundle.message("analyse.modules.with.different.platforms.together"), + null + ) { override fun isSelected(e: AnActionEvent): Boolean = e.project?.useCompositeAnalysis == true diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/StoredExceptionsThrowToggleAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/StoredExceptionsThrowToggleAction.kt index a8bfdd2d39b..8fe418a4fe4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/StoredExceptionsThrowToggleAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/StoredExceptionsThrowToggleAction.kt @@ -19,11 +19,16 @@ package org.jetbrains.kotlin.idea.actions.internal import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.ToggleAction import com.intellij.openapi.application.ApplicationManager +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.utils.WrappedValues class StoredExceptionsThrowToggleAction : - ToggleAction("Internal: toggle throwing cached PCE", "Rethrow stored PCE as a new runtime exception", null) { + ToggleAction( + KotlinBundle.message("internal.toggle.throwing.cached.pce"), + KotlinBundle.message("rethrow.stored.pce.as.a.new.runtime.exception"), + null + ) { override fun isSelected(e: AnActionEvent): Boolean { return WrappedValues.throwWrappedProcessCanceledException } diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt index 71a4acdc522..e8255f92e42 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/HighlightingBenchmarkAction.kt @@ -36,6 +36,7 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.addBoxWithLabel import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.collectSuitableKotlinFiles import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.shuffledSequence @@ -59,7 +60,10 @@ class HighlightingBenchmarkAction : AnAction() { val ktFiles = collectSuitableKotlinFiles(project) { it.getLineCount() >= settings.lines } if (ktFiles.size < settings.files) { - AbstractCompletionBenchmarkAction.showPopup(project, "Number of attempts > then files in project, ${ktFiles.size}") + AbstractCompletionBenchmarkAction.showPopup( + project, + KotlinBundle.message("number.of.attempts.then.files.in.project.0", ktFiles.size) + ) return null } @@ -122,9 +126,9 @@ class HighlightingBenchmarkAction : AnAction() { val jPanel = JBPanel>(GridLayoutManager(3, 2)).apply { var i = 0 - cSeed = addBoxWithLabel("Random seed", default = "0", i = i++) - cFiles = addBoxWithLabel("Files to visit", default = "20", i = i++) - cLines = addBoxWithLabel("Minimal line count", default = "100", i = i) + cSeed = addBoxWithLabel(KotlinBundle.message("random.seed"), default = "0", i = i++) + cFiles = addBoxWithLabel(KotlinBundle.message("files.to.visit"), default = "20", i = i++) + cLines = addBoxWithLabel(KotlinBundle.message("minimal.line.count"), default = "100", i = i) } dialogBuilder.centerPanel(jPanel) if (!dialogBuilder.showAndGet()) return null @@ -211,7 +215,7 @@ class HighlightingBenchmarkAction : AnAction() { } }) } - AbstractCompletionBenchmarkAction.showPopup(project, "Done") + AbstractCompletionBenchmarkAction.showPopup(project, KotlinBundle.message("text.done")) } override fun update(e: AnActionEvent) { diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/LocalCompletionBenchmark.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/LocalCompletionBenchmark.kt index 9460cccbcb2..4bfd7138a1a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/LocalCompletionBenchmark.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/LocalCompletionBenchmark.kt @@ -21,6 +21,7 @@ import com.intellij.openapi.ui.DialogBuilder import com.intellij.ui.components.JBPanel import com.intellij.ui.components.JBTextField import com.intellij.uiDesigner.core.GridLayoutManager +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.randomElement import org.jetbrains.kotlin.idea.completion.CompletionBenchmarkSink import org.jetbrains.kotlin.idea.core.util.getLineCount @@ -49,7 +50,7 @@ class LocalCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() { } if (ktFiles.size < settings.files) { - showPopup(project, "Number of attempts > then files in project, ${ktFiles.size}") + showPopup(project, KotlinBundle.message("number.of.attempts.then.files.in.project.0", ktFiles.size)) return null } @@ -79,10 +80,10 @@ class LocalCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() { val jPanel = JBPanel>(GridLayoutManager(4, 2)).apply { var i = 0 - cSeed = addBoxWithLabel("Random seed", default = "0", i = i++) - cFiles = addBoxWithLabel("Files to visit", default = "20", i = i++) - cFunctions = addBoxWithLabel("Max functions to visit", default = "20", i = i++) - cLines = addBoxWithLabel("File lines", default = "100", i = i) + cSeed = addBoxWithLabel(KotlinBundle.message("random.seed"), default = "0", i = i++) + cFiles = addBoxWithLabel(KotlinBundle.message("files.to.visit"), default = "20", i = i++) + cFunctions = addBoxWithLabel(KotlinBundle.message("max.functions.to.visit"), default = "20", i = i++) + cLines = addBoxWithLabel(KotlinBundle.message("file.lines"), default = "100", i = i) } dialogBuilder.centerPanel(jPanel) if (!dialogBuilder.showAndGet()) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/TopLevelCompletionBenchmark.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/TopLevelCompletionBenchmark.kt index 1e08aebb141..2e8acb8dbe3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/TopLevelCompletionBenchmark.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/benchmark/TopLevelCompletionBenchmark.kt @@ -22,6 +22,7 @@ import com.intellij.psi.PsiWhiteSpace import com.intellij.ui.components.JBPanel import com.intellij.ui.components.JBTextField import com.intellij.uiDesigner.core.GridLayoutManager +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.randomElement import org.jetbrains.kotlin.idea.completion.CompletionBenchmarkSink import org.jetbrains.kotlin.idea.core.util.getLineCount @@ -51,7 +52,7 @@ class TopLevelCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() { } if (ktFiles.size < settings.files) { - showPopup(project, "Number of attempts > then files in project, ${ktFiles.size}") + showPopup(project, KotlinBundle.message("number.of.attempts.then.files.in.project.0", ktFiles.size)) return null } @@ -78,9 +79,9 @@ class TopLevelCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() { val jPanel = JBPanel>(GridLayoutManager(3, 2)).apply { var i = 0 - cSeed = addBoxWithLabel("Random seed", default = "0", i = i++) - cFiles = addBoxWithLabel("Files to visit", default = "20", i = i++) - cLines = addBoxWithLabel("File lines", default = "100", i = i) + cSeed = addBoxWithLabel(KotlinBundle.message("random.seed"), default = "0", i = i++) + cFiles = addBoxWithLabel(KotlinBundle.message("files.to.visit"), default = "20", i = i++) + cLines = addBoxWithLabel(KotlinBundle.message("file.lines"), default = "100", i = i) } dialogBuilder.centerPanel(jPanel) if (!dialogBuilder.showAndGet()) return null diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringAction.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringAction.kt index 47a814a6462..becdf1e1cfd 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringAction.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringAction.kt @@ -19,6 +19,7 @@ import com.intellij.openapi.project.guessProjectDir import com.intellij.openapi.ui.Messages import com.intellij.openapi.vfs.VfsUtil import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.cases.MoveRefactoringCase import org.jetbrains.kotlin.idea.util.application.runWriteAction import java.io.File @@ -30,7 +31,7 @@ import java.time.format.DateTimeFormatter class MoveRefactoringAction : AnAction() { companion object { - const val WINDOW_TITLE: String = "Move refactoring testing" + val WINDOW_TITLE: String get() = KotlinBundle.message("move.refactoring.testing") const val RECENT_SELECTED_PATH = "org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.RECENT_SELECTED_PATH" } @@ -52,18 +53,18 @@ class MoveRefactoringAction : AnAction() { ) { try { - setIndicator("Update indices...", 0.0) + setIndicator(KotlinBundle.message("update.indices"), 0.0) DumbService.getInstance(project).waitForSmartMode() - setIndicator("Perform refactoring ...", 0.1) + setIndicator(KotlinBundle.message("perform.refactoring"), 0.1) fileTracker.reset() var refactoringResult: RandomMoveRefactoringResult = RandomMoveRefactoringResult.Failed edtExecute { refactoringResult = refactoring.tryCreateAndRun(project, refactoringCountBeforeCheck) - setIndicator("Saving files...", 0.3) + setIndicator(KotlinBundle.message("saving.files"), 0.3) FileDocumentManager.getInstance().saveAllDocuments() VfsUtil.markDirtyAndRefresh(false, true, true, projectRoot) } @@ -72,7 +73,7 @@ class MoveRefactoringAction : AnAction() { is RandomMoveRefactoringResult.Success -> { verifications++ - setIndicator("Compiling project...", 0.7) + setIndicator(KotlinBundle.message("compiling.project"), 0.7) if (!actionRunner.checkByBuild(cancelledChecker)) { fails++ resultsFile.appendText("${localRefactoringResult.caseData}\n\n") @@ -87,7 +88,7 @@ class MoveRefactoringAction : AnAction() { } } finally { - setIndicator("Reset files...", 0.9) + setIndicator(KotlinBundle.message("reset.files"), 0.9) fileTracker.createdFiles.toList().map { try { @@ -104,7 +105,7 @@ class MoveRefactoringAction : AnAction() { gitReset(project, projectRoot) } - setIndicator("Done", 1.0) + setIndicator(KotlinBundle.message("text.done"), 1.0) } private fun createFileIfNotExist(targetPath: String): File? { @@ -128,7 +129,7 @@ class MoveRefactoringAction : AnAction() { val projectRoot = project?.guessProjectDir() if (projectRoot === null) { - Messages.showErrorDialog(project, "Cannot get project root directory", WINDOW_TITLE) + Messages.showErrorDialog(project, KotlinBundle.message("cannot.get.project.root.directory"), WINDOW_TITLE) return } @@ -141,7 +142,7 @@ class MoveRefactoringAction : AnAction() { val resultsFile = createFileIfNotExist(targetPath) if (resultsFile === null) { - Messages.showErrorDialog(project, "Cannot get or create results file", WINDOW_TITLE) + Messages.showErrorDialog(project, KotlinBundle.message("cannot.get.or.create.results.file"), WINDOW_TITLE) return } @@ -188,7 +189,13 @@ class MoveRefactoringAction : AnAction() { try { while (!cancelledChecker()) { iteration++ - indicator.text = "$WINDOW_TITLE [Try $iteration with $fails fails and $verifications verifications]" + indicator.text = KotlinBundle.message( + "0.try.1.with.2.fails.and.3.verifications", + WINDOW_TITLE, + iteration, + fails, + verifications + ) randomRefactoringAndCheck( project = project, diff --git a/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringActionDialog.kt b/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringActionDialog.kt index 075df31d290..8249c8aaf06 100644 --- a/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringActionDialog.kt +++ b/idea/src/org/jetbrains/kotlin/idea/actions/internal/refactoringTesting/MoveRefactoringActionDialog.kt @@ -16,6 +16,7 @@ import com.intellij.ui.components.JBLabelDecorator import com.intellij.ui.components.JBTextField import com.intellij.util.ui.FormBuilder import com.intellij.util.ui.UIUtil +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.util.onTextChange import java.io.File import javax.swing.InputVerifier @@ -26,9 +27,9 @@ class MoveRefactoringActionDialog( ) : DialogWrapper(project, true) { companion object { - const val WINDOW_TITLE = "Move refactoring test" - const val COUNT_LABEL_TEXT = "Maximum count of applied refactoring before validity check" - const val LOG_FILE_WILL_BE_PLACED_HERE = "Test result log file will be placed here" + val WINDOW_TITLE get() = KotlinBundle.message("move.refactoring.test") + val COUNT_LABEL_TEXT get() = KotlinBundle.message("maximum.count.of.applied.refactoring.before.validity.check") + val LOG_FILE_WILL_BE_PLACED_HERE get() = KotlinBundle.message("test.result.log.file.will.be.placed.here") const val RECENT_SELECTED_PATH = "org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.RECENT_SELECTED_PATH" const val RECENT_SELECTED_RUN_COUNT = "org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.RECENT_SELECTED_RUN_COUNT" diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinCopyPasteReferenceProcessor.kt b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinCopyPasteReferenceProcessor.kt index d6c72b1ee68..d47b39611ca 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinCopyPasteReferenceProcessor.kt +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/KotlinCopyPasteReferenceProcessor.kt @@ -351,7 +351,7 @@ class KotlinCopyPasteReferenceProcessor : CopyPastePostProcessor() restoreReferences(selectedReferencesToRestore, file, imported) diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt index 9b4038f70e6..e702465e43b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt +++ b/idea/src/org/jetbrains/kotlin/idea/configuration/ui/migrationNotification.kt @@ -70,5 +70,8 @@ private fun StringBuilder.appendBr(line: String) = this.append("$line
") private fun StringBuilder.appendIndentBr(line: String) = appendBr("  $line") private const val KOTLIN_MIGRATION_NOTIFICATION_ID = "Kotlin Migration" -private val KOTLIN_MIGRATION_NOTIFICATION_GROUP = - NotificationGroup(KOTLIN_MIGRATION_NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON, true) +private val KOTLIN_MIGRATION_NOTIFICATION_GROUP = NotificationGroup( + KOTLIN_MIGRATION_NOTIFICATION_ID, + NotificationDisplayType.STICKY_BALLOON, + true +) diff --git a/idea/src/org/jetbrains/kotlin/idea/conversion/copy/KotlinFilePasteProvider.kt b/idea/src/org/jetbrains/kotlin/idea/conversion/copy/KotlinFilePasteProvider.kt index ebae12d68b5..f5e67124b85 100644 --- a/idea/src/org/jetbrains/kotlin/idea/conversion/copy/KotlinFilePasteProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/conversion/copy/KotlinFilePasteProvider.kt @@ -17,6 +17,7 @@ import com.intellij.psi.JavaDirectoryService import com.intellij.psi.PsiDocumentManager import com.intellij.psi.util.PsiTreeUtil import com.intellij.util.IncorrectOperationException +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.util.application.executeWriteCommand import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtFile @@ -37,7 +38,7 @@ class KotlinFilePasteProvider : PasteProvider { @Suppress("UsePropertyAccessSyntax") val directory = ideView.getOrChooseDirectory() ?: return - project.executeWriteCommand("Create Kotlin file") { + project.executeWriteCommand(KotlinBundle.message("create.kotlin.file")) { val file = try { directory.createFile(fileName) } catch (e: IncorrectOperationException) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitNullableNothingTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitNullableNothingTypeInspection.kt index acbcd6ae52e..053a03679f3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitNullableNothingTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitNullableNothingTypeInspection.kt @@ -18,10 +18,10 @@ package org.jetbrains.kotlin.idea.inspections import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.core.getModalityFromDescriptor import org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention -import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtCallableDeclaration import org.jetbrains.kotlin.psi.KtProperty @@ -30,7 +30,7 @@ import org.jetbrains.kotlin.types.typeUtil.isNullableNothing class ImplicitNullableNothingTypeInspection : IntentionBasedInspection( intention = SpecifyTypeExplicitlyIntention::class, additionalChecker = { declaration -> declaration.check() }, - problemText = "Implicit `Nothing?` type" + problemText = KotlinBundle.message("implicit.nothing.type") ) { override fun inspectionTarget(element: KtCallableDeclaration) = element.nameIdentifier } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt index 50a1e73415c..8f02279422a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt @@ -90,7 +90,7 @@ class MoveSuspiciousCallableReferenceIntoParenthesesInspection : AbstractKotlinI } class MoveIntoParenthesesIntention : ConvertLambdaToReferenceIntention( - "Move suspicious callable reference into parentheses '()'" + KotlinBundle.message("move.suspicious.callable.reference.into.parentheses") ) { override fun buildReferenceText(element: KtLambdaExpression): String? { val callableReferenceExpression = diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt index 4f6b7f3ef1a..f11ebc2e24d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt @@ -179,7 +179,7 @@ sealed class NamingConventionInspection( } class ClassNameInspection : NamingConventionInspection( - "Class", + KotlinBundle.message("class"), "[A-Z][A-Za-z\\d]*", START_UPPER, NO_UNDERSCORES, NO_BAD_CHARACTERS ) { @@ -197,7 +197,7 @@ class ClassNameInspection : NamingConventionInspection( } class EnumEntryNameInspection : NamingConventionInspection( - "Enum entry", + KotlinBundle.message("enum.entry"), "[A-Z]([A-Za-z\\d]*|[A-Z_\\d]*)", START_UPPER, NO_BAD_CHARACTERS_OR_UNDERSCORE ) { @@ -207,7 +207,7 @@ class EnumEntryNameInspection : NamingConventionInspection( } class FunctionNameInspection : NamingConventionInspection( - "Function", + KotlinBundle.message("function"), "[a-z][A-Za-z\\d]*", START_LOWER, NO_UNDERSCORES, NO_BAD_CHARACTERS ) { @@ -224,7 +224,7 @@ class FunctionNameInspection : NamingConventionInspection( } class TestFunctionNameInspection : NamingConventionInspection( - "Test function", + KotlinBundle.message("test.function"), "[a-z][A-Za-z_\\d]*", START_LOWER ) { @@ -279,30 +279,30 @@ abstract class PropertyNameInspectionBase protected constructor( class PropertyNameInspection : PropertyNameInspectionBase( - PropertyKind.NORMAL, "Property", "[a-z][A-Za-z\\d]*", + PropertyKind.NORMAL, KotlinBundle.message("property"), "[a-z][A-Za-z\\d]*", START_LOWER, NO_UNDERSCORES, NO_BAD_CHARACTERS ) class ObjectPropertyNameInspection : PropertyNameInspectionBase( PropertyKind.OBJECT_OR_TOP_LEVEL, - "Object or top-level property", + KotlinBundle.message("object.or.top.level.property"), "[A-Za-z][_A-Za-z\\d]*", NO_START_UNDERSCORE, NO_BAD_CHARACTERS_OR_UNDERSCORE ) class PrivatePropertyNameInspection : PropertyNameInspectionBase( - PropertyKind.PRIVATE, "Private property", "_?[a-z][A-Za-z\\d]*", + PropertyKind.PRIVATE, KotlinBundle.message("private.property"), "_?[a-z][A-Za-z\\d]*", NO_MIDDLE_UNDERSCORES, NO_BAD_CHARACTERS_OR_UNDERSCORE ) class ConstPropertyNameInspection : - PropertyNameInspectionBase(PropertyKind.CONST, "Const property", "[A-Z][_A-Z\\d]*") + PropertyNameInspectionBase(PropertyKind.CONST, KotlinBundle.message("const.property"), "[A-Z][_A-Z\\d]*") class LocalVariableNameInspection : PropertyNameInspectionBase( - PropertyKind.LOCAL, "Local variable", "[a-z][A-Za-z\\d]*", + PropertyKind.LOCAL, KotlinBundle.message("local.variable"), "[a-z][A-Za-z\\d]*", START_LOWER, NO_UNDERSCORES, NO_BAD_CHARACTERS ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/describeDeclaration.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/describeDeclaration.kt index ecc72cb15a3..87987a44671 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/describeDeclaration.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/describeDeclaration.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.idea.inspections +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter @@ -23,13 +24,16 @@ import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter * @return string description of declaration, like `Function "describe"` */ fun KtNamedDeclaration.describe(): String? = when (this) { - is KtClass -> "${if (isInterface()) "Interface" else "Class"} \"$name\"" - is KtObjectDeclaration -> "Object \"$name\"" - is KtNamedFunction -> "Function \"$name\"" - is KtSecondaryConstructor -> "Constructor" - is KtProperty -> "Property \"$name\"" - is KtParameter -> if (this.isPropertyParameter()) "Property \"$name\"" else "Parameter \"$name\"" - is KtTypeParameter -> "Type parameter \"$name\"" - is KtTypeAlias -> "Type alias \"$name\"" + is KtClass -> "${if (isInterface()) KotlinBundle.message("interface") else KotlinBundle.message("class")} \"$name\"" + is KtObjectDeclaration -> KotlinBundle.message("object.0", name.toString()) + is KtNamedFunction -> KotlinBundle.message("function.01", name.toString()) + is KtSecondaryConstructor -> KotlinBundle.message("constructor") + is KtProperty -> KotlinBundle.message("property.0", name.toString()) + is KtParameter -> if (this.isPropertyParameter()) + KotlinBundle.message("property.0", name.toString()) + else + KotlinBundle.message("parameter.0", name.toString()) + is KtTypeParameter -> KotlinBundle.message("type.parameter.0", name.toString()) + is KtTypeAlias -> KotlinBundle.message("type.alias.0", name.toString()) else -> null } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt index d16904f85ee..760ad033c27 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/CreateKotlinSubClassIntention.kt @@ -60,13 +60,12 @@ class CreateKotlinSubClassIntention : SelfTargetingRangeIntention( return TextRange(element.startOffset, element.body?.lBrace?.startOffset ?: element.endOffset) } - private fun getImplementTitle(baseClass: KtClass) = - when { - baseClass.isInterface() -> "Implement interface" - baseClass.isAbstract() -> "Implement abstract class" - baseClass.isSealed() -> "Implement sealed class" - else /* open class */ -> "Create subclass" - } + private fun getImplementTitle(baseClass: KtClass) = when { + baseClass.isInterface() -> KotlinBundle.message("implement.interface") + baseClass.isAbstract() -> KotlinBundle.message("implement.abstract.class") + baseClass.isSealed() -> KotlinBundle.message("implement.sealed.class") + else /* open class */ -> KotlinBundle.message("create.subclass") + } override fun startInWriteAction() = false diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ImplementAbstractMemberIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ImplementAbstractMemberIntention.kt index 70ef4be08c6..545fc9d7e72 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ImplementAbstractMemberIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ImplementAbstractMemberIntention.kt @@ -222,8 +222,8 @@ abstract class ImplementAbstractMemberIntentionBase : class ImplementAbstractMemberIntention : ImplementAbstractMemberIntentionBase() { override fun computeText(element: KtNamedDeclaration): String? = when (element) { - is KtProperty -> "Implement abstract property" - is KtNamedFunction -> "Implement abstract function" + is KtProperty -> KotlinBundle.message("implement.abstract.property") + is KtNamedFunction -> KotlinBundle.message("implement.abstract.function") else -> null } diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt index 8360f9ab66c..c1eb2217969 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt @@ -37,7 +37,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfType import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils class ReplaceExplicitFunctionLiteralParamWithItIntention : PsiElementBaseIntentionAction() { - override fun getFamilyName() = "Replace explicit lambda parameter with 'it'" + override fun getFamilyName() = KotlinBundle.message("replace.explicit.lambda.parameter.with.it") override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean { val functionLiteral = targetFunctionLiteral(element, editor.caretModel.offset) ?: return false diff --git a/idea/src/org/jetbrains/kotlin/idea/projectWizard/WizardStatsService.kt b/idea/src/org/jetbrains/kotlin/idea/projectWizard/WizardStatsService.kt index 163b42721d6..4344e0cd1d8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/projectWizard/WizardStatsService.kt +++ b/idea/src/org/jetbrains/kotlin/idea/projectWizard/WizardStatsService.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.projectWizard +import org.jetbrains.annotations.NonNls import org.jetbrains.kotlin.idea.statistics.FUSEventGroups import org.jetbrains.kotlin.idea.statistics.KotlinFUSLogger @@ -36,7 +37,7 @@ data class UiEditorUsageStats( ) } -private enum class WizardStatsEvent(val text: String) { +private enum class WizardStatsEvent(@NonNls val text: String) { PROJECT_CREATED("Project Created"), WIZARD_STATE_CHANGE("New Wizard enabled or disable") } diff --git a/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt b/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt index af1e902e55b..d82932e1d92 100644 --- a/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/testIntegration/KotlinCreateTestIntention.kt @@ -41,7 +41,10 @@ import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier import org.jetbrains.kotlin.psi.psiUtil.startOffset import java.util.* -class KotlinCreateTestIntention : SelfTargetingRangeIntention(KtNamedDeclaration::class.java, "Create test") { +class KotlinCreateTestIntention : SelfTargetingRangeIntention( + KtNamedDeclaration::class.java, + KotlinBundle.message("create.test") +) { override fun applicabilityRange(element: KtNamedDeclaration): TextRange? { if (element.hasExpectModifier() || element.nameIdentifier == null) return null if (ModuleUtilCore.findModuleForPsiElement(element) == null) return null @@ -154,7 +157,10 @@ class KotlinCreateTestIntention : SelfTargetingRangeIntention("Convert class '${generatedClass.name}' to Kotlin", this) { + project.executeCommand( + KotlinBundle.message("convert.class.0.to.kotlin", generatedClass.name.toString()), + this + ) { runWriteAction { generatedClass.methods.forEach { it.throwsList.referenceElements.forEach { referenceElement -> referenceElement.delete() }