From 0a3e577b6cf6ba99a95d655a80433b0c40c3526c Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Wed, 4 Mar 2020 15:28:43 +0700 Subject: [PATCH] i18n: add bundle for idea/inspections --- .../messages/KotlinBundle.properties | 293 +++++++++++++++++- .../AddOperatorModifierInspection.kt | 5 +- .../AddVarianceModifierInspection.kt | 7 +- .../inspections/ArrayInDataClassInspection.kt | 5 +- .../BooleanLiteralArgumentInspection.kt | 5 +- .../inspections/CanBeParameterInspection.kt | 3 +- ...nBePrimaryConstructorPropertyInspection.kt | 3 +- .../idea/inspections/CanBeValInspection.kt | 3 +- .../CanSealedSubClassBeObjectInspection.kt | 3 +- .../idea/inspections/CascadeIfInspection.kt | 3 +- .../ConflictingExtensionPropertyInspection.kt | 9 +- .../ConstantConditionIfInspection.kt | 7 +- .../ControlFlowWithEmptyBodyInspection.kt | 3 +- .../ConvertNaNEqualityInspection.kt | 5 +- ...rtPairConstructorToToFunctionInspection.kt | 5 +- ...ertTwoComparisonsToRangeCheckInspection.kt | 5 +- .../CopyWithoutNamedArgumentsInspection.kt | 3 +- .../DataClassPrivateConstructorInspection.kt | 3 +- .../DelegationToVarPropertyInspection.kt | 5 +- ...recatedCallableAddReplaceWithInspection.kt | 5 +- .../DestructuringWrongNameInspection.kt | 3 +- .../idea/inspections/EmptyRangeInspection.kt | 5 +- .../inspections/EqualsOrHashCodeInspection.kt | 13 +- .../inspections/ExplicitThisInspection.kt | 5 +- .../FakeJvmFieldConstantInspection.kt | 3 +- .../FoldInitializerAndIfToElvisInspection.kt | 5 +- .../ForEachParameterNotUsedInspection.kt | 7 +- ...ctionWithLambdaExpressionBodyInspection.kt | 7 +- .../inspections/HasPlatformTypeInspection.kt | 10 +- .../inspections/ImplicitThisInspection.kt | 12 +- .../JavaCollectionsStaticMethodInspection.kt | 5 +- ...nsStaticMethodOnImmutableListInspection.kt | 3 +- .../inspections/JavaMapForEachInspection.kt | 6 +- .../inspections/KotlinCleanupInspection.kt | 5 +- .../KotlinCovariantEqualsInspection.kt | 3 +- .../KotlinDoubleNegationInspection.kt | 5 +- ...ualsBetweenInconvertibleTypesInspection.kt | 3 +- .../KotlinInternalInJavaInspection.kt | 3 +- .../KotlinJUnitStaticEntryPoint.kt | 3 +- .../KotlinRedundantOverrideInspection.kt | 5 +- .../KotlinThrowableNotThrownInspection.kt | 5 +- .../KotlinUnusedImportInspection.kt | 5 +- ...teinitVarOverridesLateinitVarInspection.kt | 3 +- .../idea/inspections/LeakingThisInspection.kt | 9 +- .../LiftReturnOrAssignmentInspection.kt | 11 +- .../MainFunctionReturnUnitInspection.kt | 8 +- ...tWithNotNullAssertionOperatorInspection.kt | 9 +- .../inspections/MayBeConstantInspection.kt | 6 +- .../MemberVisibilityCanBePrivateInspection.kt | 7 +- .../MigrateDiagnosticSuppressionInspection.kt | 7 +- .../MoveLambdaOutsideParenthesesInspection.kt | 7 +- ...lableReferenceIntoParenthesesInspection.kt | 3 +- ...veVariableDeclarationIntoWhenInspection.kt | 11 +- .../NamingConventionInspections.kt | 37 +-- ...mbdaShadowedImplicitParameterInspection.kt | 5 +- .../NullChecksToSafeCallInspection.kt | 5 +- .../NullableBooleanElvisInspection.kt | 9 +- .../OptionalExpectationInspection.kt | 7 +- ...formExtensionReceiverOfInlineInspection.kt | 5 +- .../inspections/ProtectedInFinalInspection.kt | 7 +- .../PublicApiImplicitTypeInspection.kt | 9 +- .../RecursiveEqualsCallInspection.kt | 5 +- .../RecursivePropertyAccessorInspection.kt | 7 +- .../RedundantCompanionReferenceInspection.kt | 6 +- .../RedundantElseInIfInspection.kt | 5 +- ...edundantEmptyInitializerBlockInspection.kt | 5 +- ...dantEnumConstructorInvocationInspection.kt | 5 +- .../RedundantExplicitTypeInspection.kt | 3 +- .../inspections/RedundantGetterInspection.kt | 5 +- .../idea/inspections/RedundantIfInspection.kt | 5 +- .../RedundantLambdaArrowInspection.kt | 5 +- .../inspections/RedundantLetInspection.kt | 5 +- .../RedundantModalityModifierInspection.kt | 3 +- ...NullExtensionReceiverOfInlineInspection.kt | 3 +- .../RedundantObjectTypeCheckInspection.kt | 5 +- .../RedundantRequireNotNullCallInspection.kt | 5 +- .../RedundantReturnLabelInspection.kt | 3 +- .../RedundantSamConstructorInspection.kt | 12 +- .../RedundantSemicolonInspection.kt | 5 +- .../inspections/RedundantSetterInspection.kt | 5 +- .../RedundantSuspendModifierInspection.kt | 3 +- .../RedundantUnitExpressionInspection.kt | 5 +- .../RedundantUnitReturnTypeInspection.kt | 3 +- .../RedundantVisibilityModifierInspection.kt | 3 +- .../inspections/RedundantWithInspection.kt | 5 +- .../idea/inspections/ReformatInspection.kt | 7 +- .../idea/inspections/RemoveAnnotationFix.kt | 3 +- ...RemoveCurlyBracesFromTemplateInspection.kt | 8 +- ...arenthesesFromAnnotationEntryInspection.kt | 5 +- .../RemoveRedundantBackticksInspection.kt | 5 +- .../RemoveRedundantQualifierNameInspection.kt | 5 +- ...RemoveRedundantSpreadOperatorInspection.kt | 5 +- .../RemoveSetterParameterTypeInspection.kt | 3 +- ...emoveToStringInStringTemplateInspection.kt | 5 +- ...rayEqualityOpWithArraysEqualsInspection.kt | 9 +- .../ReplaceArrayOfWithLiteralInspection.kt | 5 +- ...sertBooleanWithAssertEqualityInspection.kt | 7 +- .../ReplaceAssociateFunctionInspection.kt | 5 +- ...eplaceCollectionCountWithSizeInspection.kt | 5 +- ...ceGuardClauseWithFunctionCallInspection.kt | 7 +- ...ceManualRangeWithIndicesCallsInspection.kt | 9 +- ...eNegatedIsEmptyWithIsNotEmptyInspection.kt | 5 +- ...tNullAssertionWithElvisReturnInspection.kt | 5 +- .../ReplacePutWithAssignmentInspection.kt | 6 +- ...tartEndInclusiveWithFirstLastInspection.kt | 9 +- .../ReplaceRangeToWithUntilInspection.kt | 5 +- ...eplaceStringFormatWithLiteralInspection.kt | 5 +- .../inspections/ReplaceStringInDocumentFix.kt | 3 +- ...aceToStringWithStringTemplateInspection.kt | 7 +- .../ReplaceToWithInfixFormInspection.kt | 5 +- .../ReplaceWithEnumMapInspection.kt | 5 +- ...ReplaceWithOperatorAssignmentInspection.kt | 10 +- .../SafeCastWithReturnInspection.kt | 5 +- .../ScopeFunctionConversionInspection.kt | 5 +- .../inspections/SelfAssignmentInspection.kt | 5 +- ...ReferenceConstructorParameterInspection.kt | 5 +- .../SetterBackingFieldAssignmentInspection.kt | 5 +- .../SimplifyAssertNotNullInspection.kt | 9 +- ...mplifyNegatedBinaryExpressionInspection.kt | 7 +- ...nWithBooleanConstantConditionInspection.kt | 5 +- .../inspections/SortModifiersInspection.kt | 5 +- .../SuspiciousAsDynamicInspection.kt | 5 +- ...piciousCollectionReassignmentInspection.kt | 11 +- .../SuspiciousEqualsCombination.kt | 3 +- .../SuspiciousVarPropertyInspection.kt | 3 +- .../UnlabeledReturnInsideLambdaInspection.kt | 3 +- .../UnnecessaryVariableInspection.kt | 12 +- .../UnsafeCastFromDynamicInspection.kt | 5 +- .../inspections/UnusedEqualsInspection.kt | 3 +- .../UnusedLambdaExpressionBodyInspection.kt | 5 +- .../UnusedMainParameterInspection.kt | 3 +- .../inspections/UnusedSymbolInspection.kt | 5 +- .../UnusedUnaryOperatorInspection.kt | 5 +- .../UseExpressionBodyInspection.kt | 13 +- .../inspections/WhenWithOnlyElseInspection.kt | 5 +- .../WrapUnaryOperatorInspection.kt | 5 +- .../idea/quickfix/RemoveReturnLabelFix.kt | 5 +- .../ui/AbstractParameterTablePanel.kt | 2 +- 138 files changed, 769 insertions(+), 315 deletions(-) diff --git a/idea/idea-analysis/resources/messages/KotlinBundle.properties b/idea/idea-analysis/resources/messages/KotlinBundle.properties index b4443520e7d..1638e81bd47 100644 --- a/idea/idea-analysis/resources/messages/KotlinBundle.properties +++ b/idea/idea-analysis/resources/messages/KotlinBundle.properties @@ -942,7 +942,7 @@ text.move.declarations=Move declarations text.move.file.0=Move {0} text.move.refactoring.not.available.during.indexing=Move refactoring is not available while indexing is in progress text.moving.multiple.nested.classes.to.top.level.not.supported=Moving multiple nested classes to top-level is not supported -text.name=Name +text.Name=Name text.nested.classes.to.upper.level=Nested Classes to Upper Level text.no.elements.to.move.are.selected=No elements to move are selected text.no.files.to.move=There is no given files to move @@ -1309,4 +1309,293 @@ replace.substring.call.with.droplast.call=Replace 'substring' call with 'dropLas replace.substring.call.with.indexing.operation.call=Replace 'substring' call with indexing operation call replace.substring.call.with.substringbefore.call=Replace 'substring' call with 'substringBefore' call replace.substring.call.with.substringafter.call=Replace 'substring' call with 'substringAfter' call -replace.substring.call.with.take.call=Replace 'substring' call with 'take' call \ No newline at end of file +replace.substring.call.with.take.call=Replace 'substring' call with 'take' call +add.operator.modifier=Add 'operator' modifier +function.should.have.operator.modifier=Function should have 'operator' modifier +type.parameter.can.have.0.variance=Type parameter can have {0} variance +add.variance.fix.text=Add ''{0}'' variance +add.variance.fix.family.name=Add variance +generate.equals.and.hashcode.fix.text=Generate equals() and hashCode() +array.property.in.data.class.it.s.recommended.to.override.equals.hashcode=Array property in data class: it's recommended to override equals() / hashCode() +report.also.on.call.with.single.boolean.literal.argument=Report also on call with single boolean literal argument +boolean.literal.argument.without.parameter.name=Boolean literal argument without parameter name +constructor.parameter.is.never.used.as.a.property=Constructor parameter is never used as a property +property.is.explicitly.assigned.to.parameter.0.can=Property is explicitly assigned to parameter {0}, can be declared directly in constructor +variable.is.never.modified.and.can.be.declared.immutable.using.val=Variable is never modified and can be declared immutable using 'val' +sealed.sub.class.has.no.state.and.no.overridden.equals=Sealed sub-class has no state and no overridden equals +cascade.if.should.be.replaced.with.when=Cascade if should be replaced with when +mark.as.deprecated.level.deprecationlevel.hidden=Mark as @Deprecated(..., level = DeprecationLevel.HIDDEN) +searching.for.imports.to.delete=Searching for imports to delete +delete.redundant.extension.property=Delete redundant extension property +this.property.conflicts.with.synthetic.extension.and.should.be.removed.or.renamed.to.avoid.breaking.code.by.future.changes.in.the.compiler=This property conflicts with synthetic extension and should be removed or renamed to avoid breaking code by future changes in the compiler +condition.is.always.0=Condition is always ''{0}'' +remove.fix.text=Delete expression +simplify.fix.text=Simplify expression +0.has.empty.body=''{0}'' has empty body +convert.na.n.equality.quick.fix.text=Replace with 'isNaN()' +equality.check.with.nan.should.be.replaced.with.isnan=Equality check with NaN should be replaced with 'isNaN()' +convert.pair.constructor.to.to.fix.text=Convert to 'to' +can.be.converted.to.to=Can be converted to 'to' +convert.to.a.range.check=Convert to a range check +two.comparisons.should.be.converted.to.a.range.check=Two comparisons should be converted to a range check +copy.method.of.data.class.is.called.without.named.arguments='copy' method of data class is called without named arguments +private.data.class.constructor.is.exposed.via.the.generated.copy.method=Private data class constructor is exposed via the generated 'copy' method. +remove.var.keyword.text=Remove var +delegating.to.var.property.does.not.take.its.changes.into.account=Delegating to 'var' property does not take its changes into account +add.replacewith.argument.to.specify.replacement.pattern=Add 'replaceWith' argument to specify replacement pattern +deprecated.annotation.without.replacewith.argument=@Deprecated annotation without 'replaceWith' argument +variable.name.0.matches.the.name.of.a.different.component=Variable name ''{0}'' matches the name of a different component +replace.with.down.to.fix.text=Replace with 'downTo' +this.range.is.empty.did.you.mean.to.use.downto=This range is empty. Did you mean to use 'downTo'? +equals.hashcode.in.object.declaration=equals()/hashCode() in object declaration +hash.code.text=Generate 'hashCode()' +equals.text=Generate 'equals()' +delete.equals.and.hash.code.fix.text=Delete equals()/hashCode() +redundant.explicit.this=Redundant explicit this +explicit.this.expression.fix.family.name=Remove redundant ''{0}'' +use.of.non.const.kotlin.property.as.java.constant.is.incorrect.will.be.forbidden.in.1.4=Use of non-const Kotlin property as Java constant is incorrect. Will be forbidden in 1.4 +replace.if.with.elvis.operator=Replace 'if' with elvis operator +if.null.return.break.foldable.to=If-Null return/break/... foldable to '?:' +loop.parameter.0.is.unused=Loop parameter ''{0}'' is unused +replace.with.repeat.fix.family.name=Replace with 'repeat()' +introduce.anonymous.parameter.fix.family.name=Introduce anonymous parameter +wrap.run.fix.text=Convert to run { ... } +remove.braces.fix.text=Remove braces +function.with.and.inferred.return.type=Function with `= { ... }` and inferred return type +report.for.types.with.platform.arguments=Report for types with platform arguments +apply.only.to.public.or.protected.members=Apply only to public or protected members +declaration.has.type.inferred.from.a.platform.call.which.can.lead.to.unchecked.nullability.issues=Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. Specify type explicitly as nullable or non-nullable. +callable.reference.fix.family.name=Add explicit ''{0}'' +java.collections.static.method.call.should.be.replaced.with.kotlin.stdlib=Java Collections static method call should be replaced with Kotlin stdlib +replace.with.std.lib.fix.text=Replace with {0}.{1} +call.of.java.mutator.0.on.immutable.kotlin.collection.1=Call of Java mutator ''{0}'' on immutable Kotlin collection ''{1}'' +replace.with.kotlin.s.foreach=Replace with Kotlin's forEach +java.map.foreach.method.call.should.be.replaced.with.kotlin.s.foreach=Java Map.forEach method call should be replaced with Kotlin's forEach +remove.deprecated.symbol.import=Remove deprecated symbol import +usage.of.redundant.or.deprecated.syntax.or.deprecated.symbols=Usage of redundant or deprecated syntax or deprecated symbols +equals.should.take.any.as.its.argument='equals' should take 'Any?' as its argument +double.negation.fix.text=Remove redundant negations +redundant.double.negation=Redundant double negation +equals.between.objects.of.inconvertible.types='equals()' between objects of inconvertible types +usage.of.kotlin.internal.declaration.from.different.module=Usage of Kotlin internal declaration from different module +junit.static.methods=JUnit static methods +redundant.override.fix.text=Remove redundant overriding method +redundant.overriding.method=Redundant overriding method +throwable.instance.0.is.not.thrown=Throwable instance ''{0}'' is not thrown +result.of.0.call.is.not.thrown=Result of ''{0}'' call is not thrown +optimize.imports=Optimize imports +unused.import.directive=Unused import directive +lateinit.var.overrides.lateinit.var=lateinit var overrides lateinit var +leaking.this.in.constructor.of.non.final.class.0=Leaking 'this' in constructor of non-final class {0} +leaking.this.in.constructor.of.enum.class.0.with.overridable.members=Leaking 'this' in constructor of enum class {0} (with overridable members) +accessing.non.final.property.0.in.constructor=Accessing non-final property {0} in constructor +calling.non.final.function.0.in.constructor=Calling non-final function {0} in constructor +text.can=can +text.should=should +text.Assignment=Assignment +text.Return=Return +text.return=return +0.1.be.lifted.out.of.2={0} {1} be lifted out of ''{2}'' +lift.assignment.out.fix.text.0=Lift assignment out of ''{0}'' +lift.return.out.fix.text.0=Lift return out of ' +change.main.function.return.type.to.unit.fix.text=Add explicit Unit return type +change.main.function.return.type.to.unit.fix.text2=Change return type to Unit +0.should.return.unit={0} should return Unit +junit.test=JUnit test +map.get.with.not.null.assertion.operator=map.get() with not-null assertion operator (!!) +replace.with.get.or.else.fix.text=Replace with 'getOrElse' call +replace.with.get.value.call.fix.text=Replace with 'getValue' call +replace.with.elvis.error.fix.text=Replace with '?: error("")' +might.be.const=Might be 'const' +const.might.be.used.instead.of.jvmfield='const' might be used instead of '@JvmField' +text.Function=Function +text.Property=Property +0.1.could.be.private={0} ''{1}'' could be private +diagnostic.name.should.be.replaced.by.the.new.one=Diagnostic name should be replaced by the new one +replace.diagnostic.name.fix.text={0} with {1} +replace.diagnostic.name.fix.family.name=Replace diagnostic name +lambda.argument.0.be.moved.out=Lambda argument {0} be moved out of parentheses +move.lambda.argument.out.of.parentheses=Move lambda argument out of parentheses +suspicious.callable.reference.as.the.only.lambda.element=Suspicious callable reference as the only lambda element +inline.variable=Inline variable +move.variable.declaration.into.when=Move variable declaration into `when` +nothing.to.do=Nothing to do +variable.declaration.could.be.inlined=Variable declaration could be inlined +variable.declaration.could.be.moved.into.when=Variable declaration could be moved into `when` +may.contain.only.letters.digits.or.underscores=may contain only letters, digits or underscores +may.contain.only.letters.and.digits=may contain only letters and digits +should.not.contain.underscores.in.the.middle.or.the.end=should not contain underscores in the middle or the end +should.not.start.with.an.underscore=should not start with an underscore +should.not.start.with.an.uppercase.letter=should not start with an uppercase letter +should.not.contain.underscores=should not contain underscores +should.start.with.a.lowercase.letter=should start with a lowercase letter +should.start.with.an.uppercase.letter=should start with an uppercase letter +doesn.t.match.regex.0=doesn't match regex ''{0}'' +text.pattern=Pattern: +package.name=Package name +text.part=part +text.name=name +text.Package=Package +add.explicit.parameter.to.outer.lambda.fix.text=Add explicit parameter name to outer lambda +implicit.parameter.it.of.enclosing.lambda.is.shadowed=Implicit parameter 'it' of enclosing lambda is shadowed +equality.cehck.0.be.used.instead.of.elvis.for.nullable.boolean.check=Equality check {0} be used instead of elvis for nullable boolean check +replace.with.equality.check.fix.text=Replace with equality check +null.checks.to.safe.call.check.fix.text=Replace chained null-checks with safe-calls +null.checks.replaceable.with.safe.calls=Null-checks replaceable with safe-calls +optionally.expected.annotation.has.no.actual.annotation.in.module.0.for.platform.1=Optionally expected annotation has no actual annotation in module {0} for platform {1} +call.of.inline.function.with.nullable.extension.receiver.can.provoke.npe.in.kotlin.1.2=Call of inline function with nullable extension receiver can provoke NPE in Kotlin 1.2+ +make.open.fix.text=Make class open +make.private.fix.text=Make private +protected.visibility.is.effectively.private.in.a.final.class='protected' visibility is effectively 'private' in a final class +apply.also.to.private.members=Apply also to private members +apply.also.to.internal.members=Apply also to internal members +for.api.stability.it.s.recommended.to.specify.explicitly.declaration.types=For API stability, it's recommended to specify explicitly declaration types +for.api.stability.it.s.recommended.to.specify.explicitly.public.protected.declaration.types=For API stability, it's recommended to specify explicitly public & protected declaration types +recursive.equals.call=Recursive equals call +replace.with.field.fix.text=Replace with 'field' +recursive.synthetic.property.accessor=Recursive synthetic property accessor +recursive.property.accessor=Recursive property accessor +remove.redundant.companion.reference.fix.text=Remove redundant Companion reference +redundant.companion.reference=Redundant Companion reference +remove.redundant.else.fix.text=Remove redundant 'else' +redundant.else=Redundant 'else' +remove.initializer.block.fix.text=Remove initializer block +redundant.empty.initializer.block=Redundant empty initializer block +remove.enum.constructor.invocation.fix.text=Remove enum constructor invocation +redundant.enum.constructor.invocation=Redundant enum constructor invocation +explicitly.given.type.is.redundant.here=Explicitly given type is redundant here +remove.redundant.getter.fix.text=Remove redundant getter +redundant.getter=Redundant getter +remove.redundant.if.text=Remove redundant 'if' statement +redundant.if.statement=Redundant 'if' statement +delete.fix.family.name=Remove arrow +redundant.lambda.arrow=Redundant lambda arrow +remove.let.call=Remove `let` call +redundant.let.call.could.be.removed=Redundant `let` call could be removed +redundant.modality.modifier=Redundant modality modifier +this.type.probably.can.be.changed.to.nullable=This type probably can be changed to nullable +redundant.type.checks.for.object=Redundant type checks for object +replace.with.equality.fix.text=Replace ''{0}'' with ''{1}'' +redundant.0.call=Redundant ''{0}'' call +remove.require.not.null.call.fix.text=Remove ''{0}'' call +remove.return.label.fix.text=Remove redundant ''@{0}'' +remove.return.label.fix.family=Remove redundant label +redundant.0=Redundant ''@{0}'' +remove.redundant.sam.constructors=Remove redundant SAM-constructors +remove.redundant.sam.constructor=Remove redundant SAM-constructor +redundant.sam.constructors=Redundant SAM-constructors +redundant.sam.constructor=Redundant SAM-constructor +fix.text=Remove redundant semicolon +redundant.semicolon=Redundant semicolon +remove.redundant.setter.fix.text=Remove redundant setter +redundant.setter=Redundant setter +redundant.suspend.modifier=Redundant 'suspend' modifier +redundant.unit.return.type=Redundant 'Unit' return type +redundant.visibility.modifier=Redundant visibility modifier +remove.redundant.unit.fix.text=Remove redundant 'Unit' +redundant.unit=Redundant 'Unit' +remove.redundant.with.fix.text=Remove redundant 'with' call +redundant.with.call=Redundant 'with' call +reformat.quick.fix.family.name=Reformat File +apply.only.to.modified.files.for.projects.under.a.version.control=Apply only to modified files (for projects under a version control) +file.is.not.properly.formatted=File is not properly formatted +remove.jvmoverloads.annotation=Remove @JvmOverloads annotation +report.also.for.a.variables.without.a.whitespace.around=Report also for a variables without a whitespace around +remove.curly.braces=Remove curly braces +redundant.curly.braces.in.string.template=Redundant curly braces in string template +remove.empty.parentheses.from.annotation.entry.fix.text=Remove unnecessary parentheses +parentheses.should.be.removed=Parentheses should be removed +remove.redundant.qualifier.name.quick.fix.text=Remove redundant qualifier name +redundant.qualifier.name=Redundant qualifier name +remove.redundant.backticks.quick.fix.text=Remove redundant backticks +remove.redundant.spread.operator.quickfix.text=Remove redundant spread operator +remove.to.string.fix.text=Remove 'toString()' call +redundant.tostring.call.in.string.template=Redundant 'toString()' call in string template +redundant.setter.parameter.type=Redundant setter parameter type +replace.with.contentequals=Replace '!=' with 'contentEquals' +replace.with.contentequals2=Replace '==' with 'contentEquals' +replace.with.contentequals3=Replace with 'contentEquals' +dangerous.array.comparison=Dangerous array comparison +replace.with.array.literal.fix.family.name=Replace with [...] +0.call.should.be.replaced.with.array.literal=''{0}'' call should be replaced with array literal [...] +replace.assert.boolean.with.assert.equality=Replace assert boolean with assert equality +replace.0.with.1=Replace ''{0}'' with ''{1}'' +replace.collection.count.with.size.quick.fix.text=Replace 'count' with 'size' +could.be.replaced.with.size=Could be replaced with `size` +replace.with.kotlin.s.function.call=Replace with kotlin's function call +replace.guard.clause.with.kotlin.s.function.call=Replace guard clause with kotlin's function call +replace.index.loop.with.collection.loop.quick.fix.text=Replace with loop over elements +replace.manual.range.with.indices.call.quick.fix.text=Replace with indices +range.could.be.replaced.with.indices.call=Range could be replaced with '.indices' call +for.loop.over.indices.could.be.replaced.with.loop.over.elements=For loop over indices could be replaced with loop over elements +replace.negated.0.with.1=Replace negated ''{0}'' with ''{1}'' +replace.with.elvis.return.fix.text=Replace with ''?: return{0}'' +replace.with.return=Replace '!!' with '?: return' +convert.put.to.assignment=Convert put to assignment +map.put.should.be.converted.to.assignment=map.put() should be converted to assignment +replace.int.range.end.inclusive.with.last.quick.fix.text=Replace 'endInclusive' with 'last' +replace.int.range.start.with.first.quick.fix.text=Replace 'start' with 'first' +could.be.replaced.with.unboxed.last=Could be replaced with unboxed `last` +could.be.replaced.with.unboxed.first=Could be replaced with unboxed `first` +replace.with.until.quick.fix.text=Replace with until +rangeto.or.the.call.should.be.replaced.with.until='rangeTo' or the '..' call should be replaced with 'until' +replace.with.string.literal.fix.family.name=Replace with string templates +string.format.call.can.be.replaced.with.string.templates=String.format call can be replaced with string templates +replace.tostring.with.string.template=Replace 'toString' with string template +call.of.tostring.could.be.replaced.with.string.template=Call of 'toString' could be replaced with string template +replace.to.with.infix.form.quickfix.text=Replace 'to' with infix form +replace.with.enum.map.fix.text=Replace with EnumMap +replaceable.with.enummap=Replaceable with EnumMap +replace.with.operator.assignment=Replace with operator-assignment +replaceable.with.operator.assignment=Replaceable with operator-assignment +replace.with.0.eq=Replace with ''{0}='' +replace.with.if.fix.text=Replace with 'if' type check +should.be.replaced.with.if.type.check=Should be replaced with 'if' type check +call.is.replaceable.with.another.scope.function=Call is replaceable with another scope function +convert.scope.function.fix.family.name=Convert to ''{0}'' +variable.0.is.assigned.to.itself=Variable ''{0}'' is assigned to itself +remove.self.assignment.fix.text=Remove self assignment +convert.to.nullable.type.fix.text=Convert to nullable type +constructor.has.non.null.self.reference.parameter=Constructor has non-null self reference parameter +assign.backing.field.fix.text=Assign backing field +existing.backing.field.is.not.assigned.by.the.setter=Existing backing field is not assigned by the setter +replace.with.error=Replace with '?: error(...)' +replace.with.operator=Replace with '!!' operator +replace.assert.with.operator=Replace assert with operator +assert.should.be.replaced.with.operator=assert should be replaced with operator +simplify.negated.operation=Simplify negated operation +negated.operation.should.be.simplified=Negated operation should be simplified +replace.negated.0.operation.with.1=Replace negated ''{0}'' operation with ''{1}'' +simplify.when.fix.text=Simplify 'when' +this.when.is.simplifiable=This 'when' is simplifiable +sort.modifiers=Sort modifiers +non.canonical.modifiers.order=Non-canonical modifiers order +modifiers.should.follow.annotations=Modifiers should follow annotations +remove.as.dynamic.call.fix.text=Remove 'asDynamic' invocation +suspicious.asdynamic.member.invocation=Suspicious 'asDynamic' member invocation +0.creates.new.1.under.the.hood=''{0}'' creates new {1} under the hood +replace.with.filter.fix.text=Replace with filter +change.type.to.mutable.fix.text=Change type to mutable +replace.with.assignment.fix.text=Replace with assignment (original is empty) +join.with.initializer.fix.text=Join with initializer +suspicious.combination.of.and=Suspicious combination of == and === +unlabeled.return.inside.lambda=Unlabeled return inside lambda +suspicious.var.property.its.setter.does.not.influence.its.getter.result=Suspicious 'var' property: its setter does not influence its getter result +variable.used.only.in.following.return.and.should.be.inlined=Variable used only in following return and should be inlined +variable.is.same.as.0.and.should.be.inlined=Variable is same as ''{0}'' and should be inlined +implicit.unsafe.cast.from.dynamic.to.0=Implicit (unsafe) cast from dynamic to {0} +cast.explicitly.fix.text=Cast explicitly +unused.equals.expression=Unused equals expression +since.kotlin.1.3.main.parameter.is.not.necessary=Since Kotlin 1.3 main parameter is not necessary +remove.token.from.function.declaration=Remove '=' token from function declaration +unused.return.value.of.a.function.with.lambda.expression.body=Unused return value of a function with lambda expression body +safe.delete.constructor=Safe delete constructor +remove.unary.operator.fix.text=Remove unused unary operator +unused.unary.operator=Unused unary operator +one.line.return=one-line return +return.when='return when' +block.body=block body +use.expression.body.instead.of.0=Use expression body instead of {0} +convert.to.expression.body.fix.text=Convert to expression body +when.has.only.else.branch.and.should.be.simplified='when' has only 'else' branch and should be simplified +wrap.unary.operator.quickfix.text=Wrap unary operator and value with () \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/AddOperatorModifierInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/AddOperatorModifierInspection.kt index a3c8ba82aff..8795ada8461 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/AddOperatorModifierInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/AddOperatorModifierInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.refactoring.withExpectedActuals import org.jetbrains.kotlin.idea.util.application.runWriteAction @@ -18,9 +19,9 @@ import org.jetbrains.kotlin.util.OperatorChecks class AddOperatorModifierInspection : AbstractApplicabilityBasedInspection(KtNamedFunction::class.java) { override fun inspectionHighlightRangeInElement(element: KtNamedFunction) = element.nameIdentifierTextRangeInThis() - override fun inspectionText(element: KtNamedFunction) = "Function should have 'operator' modifier" + override fun inspectionText(element: KtNamedFunction) = KotlinBundle.message("function.should.have.operator.modifier") - override val defaultFixText = "Add 'operator' modifier" + override val defaultFixText = KotlinBundle.message("add.operator.modifier") override fun isApplicable(element: KtNamedFunction): Boolean { if (element.nameIdentifier == null || element.hasModifier(KtTokens.OPERATOR_KEYWORD)) return false diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/AddVarianceModifierInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/AddVarianceModifierInspection.kt index 8cdd04e1e1d..9c2a5cde29c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/AddVarianceModifierInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/AddVarianceModifierInspection.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.MemberDescriptor import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.diagnostics.DiagnosticSink +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -64,7 +65,7 @@ class AddVarianceModifierInspection : AbstractKotlinInspection() { val fixes = variances.map(::AddVarianceFix) holder.registerProblem( typeParameter, - "Type parameter can have $suggested variance", + KotlinBundle.message("type.parameter.can.have.0.variance", suggested), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, *fixes.toTypedArray() ) @@ -86,9 +87,9 @@ class AddVarianceModifierInspection : AbstractKotlinInspection() { class AddVarianceFix(val variance: Variance) : LocalQuickFix { - override fun getName() = "Add '$variance' variance" + override fun getName() = KotlinBundle.message("add.variance.fix.text", variance) - override fun getFamilyName() = "Add variance" + override fun getFamilyName() = KotlinBundle.message("add.variance.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { if (!FileModificationService.getInstance().preparePsiElementForWrite(descriptor.psiElement)) return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt index 61124f1d51b..357cebcec53 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ArrayInDataClassInspection.kt @@ -11,6 +11,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateEqualsAndHashcodeAction import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny @@ -36,7 +37,7 @@ class ArrayInDataClassInspection : AbstractKotlinInspection() { if (KotlinBuiltIns.isArray(type) || KotlinBuiltIns.isPrimitiveArray(type)) { holder.registerProblem( parameter, - "Array property in data class: it's recommended to override equals() / hashCode()", + KotlinBundle.message("array.property.in.data.class.it.s.recommended.to.override.equals.hashcode"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, GenerateEqualsAndHashcodeFix() ) @@ -65,7 +66,7 @@ class ArrayInDataClassInspection : AbstractKotlinInspection() { } class GenerateEqualsAndHashcodeFix : LocalQuickFix { - override fun getName() = "Generate equals() and hashCode()" + override fun getName() = KotlinBundle.message("generate.equals.and.hashcode.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt index 0abe16f4536..fac530ab75c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/BooleanLiteralArgumentInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.diagnostics.Severity +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.intentions.AddNameToArgumentIntention @@ -69,14 +70,14 @@ class BooleanLiteralArgumentInspection( IntentionWrapper(AddNameToArgumentIntention(), argument.containingKtFile) } holder.registerProblemWithoutOfflineInformation( - argument, "Boolean literal argument without parameter name", + argument, KotlinBundle.message("boolean.literal.argument.without.parameter.name"), isOnTheFly, highlightType, fix ) }) override fun createOptionsPanel(): JComponent? { val panel = MultipleCheckboxOptionsPanel(this) - panel.addCheckbox("Report also on call with single boolean literal argument", "reportSingle") + panel.addCheckbox(KotlinBundle.message("report.also.on.call.with.single.boolean.literal.argument"), "reportSingle") return panel } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt index b704ca4f1cf..a6116243ea5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeParameterInspection.kt @@ -20,6 +20,7 @@ import com.intellij.psi.search.PsiSearchHelper.SearchCostResult.FEW_OCCURRENCES import com.intellij.psi.search.PsiSearchHelper.SearchCostResult.ZERO_OCCURRENCES import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.quickfix.RemoveValVarFromParameterFix import org.jetbrains.kotlin.idea.references.KtSimpleNameReference import org.jetbrains.kotlin.idea.search.isCheapEnoughToSearchConsideringOperators @@ -102,7 +103,7 @@ class CanBeParameterInspection : AbstractKotlinInspection() { if (references.any { it.element.parent is KtCallableReferenceExpression || it.usedAsPropertyIn(klass) }) return holder.registerProblem( valOrVar, - "Constructor parameter is never used as a property", + KotlinBundle.message("constructor.parameter.is.never.used.as.a.property"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveValVarFix(parameter) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/CanBePrimaryConstructorPropertyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/CanBePrimaryConstructorPropertyInspection.kt index cd99105b364..added72c06f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/CanBePrimaryConstructorPropertyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/CanBePrimaryConstructorPropertyInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.MovePropertyToConstructorIntention import org.jetbrains.kotlin.idea.intentions.loopToCallChain.hasUsages @@ -56,7 +57,7 @@ class CanBePrimaryConstructorPropertyInspection : AbstractKotlinInspection() { holder.manager.createProblemDescriptor( nameIdentifier, nameIdentifier, - "Property is explicitly assigned to parameter ${assignedDescriptor.name}, can be declared directly in constructor", + KotlinBundle.message("property.is.explicitly.assigned.to.parameter.0.can", assignedDescriptor.name), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly, MovePropertyToConstructorIntention() diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeValInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeValInspection.kt index 6387b502821..1c0a85f4559 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeValInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/CanBeValInspection.kt @@ -30,6 +30,7 @@ import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.AccessTarget import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.WriteValueInstruction import org.jetbrains.kotlin.cfg.pseudocode.instructions.special.LocalFunctionDeclarationInstruction import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.quickfix.ChangeVariableMutabilityFix import org.jetbrains.kotlin.idea.references.KtSimpleNameReference @@ -56,7 +57,7 @@ class CanBeValInspection : AbstractKotlinInspection() { val problemDescriptor = holder.manager.createProblemDescriptor( keyword, keyword, - "Variable is never modified and can be declared immutable using 'val'", + KotlinBundle.message("variable.is.never.modified.and.can.be.declared.immutable.using.val"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly, IntentionWrapper(ChangeVariableMutabilityFix(declaration, false), declaration.containingFile) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/CanSealedSubClassBeObjectInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/CanSealedSubClassBeObjectInspection.kt index f315f6f02f2..93257905908 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/CanSealedSubClassBeObjectInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/CanSealedSubClassBeObjectInspection.kt @@ -20,6 +20,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.asJava.classes.KtLightClassImpl +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.quickfix.sealedSubClassToObject.ConvertSealedSubClassToObjectFix @@ -59,7 +60,7 @@ class CanSealedSubClassBeObjectInspection : AbstractKotlinInspection() { val keyword = klass.getClassOrInterfaceKeyword() ?: return holder.registerProblem( keyword, - "Sealed sub-class has no state and no overridden equals", + KotlinBundle.message("sealed.sub.class.has.no.state.and.no.overridden.equals"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ConvertSealedSubClassToObjectFix(), GenerateIdentityEqualsFix() diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/CascadeIfInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/CascadeIfInspection.kt index 98e52e90536..bcbf9f6664c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/CascadeIfInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/CascadeIfInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.LocalInspectionToolSession import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfToWhenIntention import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isElseIf import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isOneLiner @@ -52,7 +53,7 @@ class CascadeIfInspection : AbstractKotlinInspection() { holder.registerProblem( expression.ifKeyword, - "Cascade if should be replaced with when", + KotlinBundle.message("cascade.if.should.be.replaced.with.when"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, IntentionWrapper(IfToWhenIntention(), expression.containingKtFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ConflictingExtensionPropertyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ConflictingExtensionPropertyInspection.kt index b774b683ac4..462db80b597 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ConflictingExtensionPropertyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ConflictingExtensionPropertyInspection.kt @@ -24,6 +24,7 @@ import com.intellij.psi.search.searches.ReferencesSearch import com.intellij.ui.GuiUtils import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny @@ -69,7 +70,7 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection() { val problemDescriptor = holder.manager.createProblemDescriptor( nameElement, - "This property conflicts with synthetic extension and should be removed or renamed to avoid breaking code by future changes in the compiler", + KotlinBundle.message("this.property.conflicts.with.synthetic.extension.and.should.be.removed.or.renamed.to.avoid.breaking.code.by.future.changes.in.the.compiler"), true, fixes, ProblemHighlightType.GENERIC_ERROR_OR_WARNING @@ -177,7 +178,7 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection() { private class DeleteRedundantExtensionAction(property: KtProperty) : KotlinQuickFixAction(property) { private val LOG = Logger.getInstance(DeleteRedundantExtensionAction::class.java) - override fun getFamilyName() = "Delete redundant extension property" + override fun getFamilyName() = KotlinBundle.message("delete.redundant.extension.property") override fun getText() = familyName override fun startInWriteAction() = false @@ -187,7 +188,7 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection() { val fqName = declaration.unsafeResolveToDescriptor(BodyResolveMode.PARTIAL).importableFqName if (fqName != null) { ProgressManager.getInstance().run( - object : Task.Modal(project, "Searching for imports to delete", true) { + object : Task.Modal(project, KotlinBundle.message("searching.for.imports.to.delete"), true) { override fun run(indicator: ProgressIndicator) { val importsToDelete = runReadAction { val searchScope = KotlinSourceFilterScope.projectSources(GlobalSearchScope.projectScope(project), project) @@ -220,7 +221,7 @@ class ConflictingExtensionPropertyInspection : AbstractKotlinInspection() { } private class MarkHiddenAndDeprecatedAction(property: KtProperty) : KotlinQuickFixAction(property) { - override fun getFamilyName() = "Mark as @Deprecated(..., level = DeprecationLevel.HIDDEN)" + override fun getFamilyName() = KotlinBundle.message("mark.as.deprecated.level.deprecationlevel.hidden") override fun getText() = familyName override fun invoke(project: Project, editor: Editor?, file: KtFile) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ConstantConditionIfInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ConstantConditionIfInspection.kt index 9c07a03bb28..c8da4fb8674 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ConstantConditionIfInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ConstantConditionIfInspection.kt @@ -12,6 +12,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import com.intellij.psi.search.LocalSearchScope import com.intellij.psi.search.searches.ReferencesSearch +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isElseIf @@ -38,7 +39,7 @@ class ConstantConditionIfInspection : AbstractKotlinInspection() { val fixes = collectFixes(expression, constantValue) holder.registerProblem( expression.condition!!, - "Condition is always '$constantValue'", + KotlinBundle.message("condition.is.always.0", constantValue), *fixes.toTypedArray() ) } @@ -89,7 +90,7 @@ class ConstantConditionIfInspection : AbstractKotlinInspection() { ) : ConstantConditionIfFix { override fun getFamilyName() = name - override fun getName() = "Simplify expression" + override fun getName() = KotlinBundle.message("simplify.fix.text") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val ifExpression = descriptor.psiElement.getParentOfType(strict = true) ?: return @@ -107,7 +108,7 @@ class ConstantConditionIfInspection : AbstractKotlinInspection() { private class RemoveFix : ConstantConditionIfFix { override fun getFamilyName() = name - override fun getName() = "Delete expression" + override fun getName() = KotlinBundle.message("remove.fix.text") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val ifExpression = descriptor.psiElement.getParentOfType(strict = true) ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ControlFlowWithEmptyBodyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ControlFlowWithEmptyBodyInspection.kt index 9285c702535..91318296aac 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ControlFlowWithEmptyBodyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ControlFlowWithEmptyBodyInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.inspections.collections.isCalling import org.jetbrains.kotlin.idea.util.hasComments import org.jetbrains.kotlin.lexer.KtTokens @@ -76,7 +77,7 @@ class ControlFlowWithEmptyBodyInspection : AbstractKotlinInspection() { registerProblem( expression, keyword.textRange.shiftLeft(expression.startOffset), - "'$keywordText' has empty body" + KotlinBundle.message("0.has.empty.body", keywordText) ) } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertNaNEqualityInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertNaNEqualityInspection.kt index 7c5210dee22..2ac1b5623e0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertNaNEqualityInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertNaNEqualityInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -27,7 +28,7 @@ class ConvertNaNEqualityInspection : AbstractKotlinInspection() { } holder.registerProblem( expression, - "Equality check with NaN should be replaced with 'isNaN()'", + KotlinBundle.message("equality.check.with.nan.should.be.replaced.with.isnan"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ConvertNaNEqualityQuickFix(inverted) ) @@ -37,7 +38,7 @@ class ConvertNaNEqualityInspection : AbstractKotlinInspection() { } private class ConvertNaNEqualityQuickFix(val inverted: Boolean) : LocalQuickFix { - override fun getName() = "Replace with 'isNaN()'" + override fun getName() = KotlinBundle.message("convert.na.n.equality.quick.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertPairConstructorToToFunctionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertPairConstructorToToFunctionInspection.kt index e37cddbd061..980a6355461 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertPairConstructorToToFunctionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertPairConstructorToToFunctionInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.getCallableDescriptor import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtCallExpression @@ -25,7 +26,7 @@ class ConvertPairConstructorToToFunctionInspection : AbstractKotlinInspection() if (expression.isPairConstructorCall()) { holder.registerProblem( expression, - "Can be converted to 'to'", + KotlinBundle.message("can.be.converted.to.to"), ProblemHighlightType.INFORMATION, ConvertPairConstructorToToFix() ) @@ -35,7 +36,7 @@ class ConvertPairConstructorToToFunctionInspection : AbstractKotlinInspection() } private class ConvertPairConstructorToToFix : LocalQuickFix { - override fun getName() = "Convert to 'to'" + override fun getName() = KotlinBundle.message("convert.pair.constructor.to.to.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertTwoComparisonsToRangeCheckInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertTwoComparisonsToRangeCheckInspection.kt index 39fb78cd246..290f1a18ea0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertTwoComparisonsToRangeCheckInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ConvertTwoComparisonsToRangeCheckInspection.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.tree.IElementType import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.branchedTransformations.evaluatesTo import org.jetbrains.kotlin.lexer.KtTokens @@ -23,9 +24,9 @@ import org.jetbrains.kotlin.types.typeUtil.isPrimitiveNumberType class ConvertTwoComparisonsToRangeCheckInspection : AbstractApplicabilityBasedInspection(KtBinaryExpression::class.java) { - override fun inspectionText(element: KtBinaryExpression) = "Two comparisons should be converted to a range check" + override fun inspectionText(element: KtBinaryExpression) = KotlinBundle.message("two.comparisons.should.be.converted.to.a.range.check") - override val defaultFixText = "Convert to a range check" + override val defaultFixText = KotlinBundle.message("convert.to.a.range.check") override fun isApplicable(element: KtBinaryExpression) = generateRangeExpressionData(element) != null diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/CopyWithoutNamedArgumentsInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/CopyWithoutNamedArgumentsInspection.kt index 517561e56ad..e9d58c05eec 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/CopyWithoutNamedArgumentsInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/CopyWithoutNamedArgumentsInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.AddNamesToCallArgumentsIntention import org.jetbrains.kotlin.psi.KtNameReferenceExpression @@ -37,7 +38,7 @@ class CopyWithoutNamedArgumentsInspection : AbstractKotlinInspection() { holder.registerProblem( expression.calleeExpression ?: return, - "'copy' method of data class is called without named arguments", + KotlinBundle.message("copy.method.of.data.class.is.called.without.named.arguments"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, IntentionWrapper(AddNamesToCallArgumentsIntention(), expression.containingKtFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/DataClassPrivateConstructorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/DataClassPrivateConstructorInspection.kt index b47a0fdd651..0a0f8b465a7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/DataClassPrivateConstructorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/DataClassPrivateConstructorInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.primaryConstructorVisitor import org.jetbrains.kotlin.psi.psiUtil.containingClass @@ -21,7 +22,7 @@ class DataClassPrivateConstructorInspection : AbstractKotlinInspection() { val problemDescriptor = holder.manager.createProblemDescriptor( keyword, keyword, - "Private data class constructor is exposed via the generated 'copy' method.", + KotlinBundle.message("private.data.class.constructor.is.exposed.via.the.generated.copy.method"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/DelegationToVarPropertyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/DelegationToVarPropertyInspection.kt index 186c443e969..f63c7e42481 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/DelegationToVarPropertyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/DelegationToVarPropertyInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.* import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.quickfix.ChangeVariableMutabilityFix import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.lexer.KtTokens @@ -20,7 +21,7 @@ class DelegationToVarPropertyInspection : AbstractKotlinInspection() { if (parameter.valOrVarKeyword?.node?.elementType != KtTokens.VAR_KEYWORD) return holder.registerProblem( parameter, - "Delegating to 'var' property does not take its changes into account", + KotlinBundle.message("delegating.to.var.property.does.not.take.its.changes.into.account"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, IntentionWrapper(ChangeVariableMutabilityFix(parameter, false), parameter.containingFile), RemoveVarKeyword() @@ -29,7 +30,7 @@ class DelegationToVarPropertyInspection : AbstractKotlinInspection() { } private class RemoveVarKeyword : LocalQuickFix { - override fun getName() = "Remove var" + override fun getName() = KotlinBundle.message("remove.var.keyword.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/DeprecatedCallableAddReplaceWithInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/DeprecatedCallableAddReplaceWithInspection.kt index 0fbc5f6f3cb..10e73a187b2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/DeprecatedCallableAddReplaceWithInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/DeprecatedCallableAddReplaceWithInspection.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithVisibility import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny @@ -37,13 +38,13 @@ import java.util.* class DeprecatedCallableAddReplaceWithInspection : AbstractApplicabilityBasedInspection( KtCallableDeclaration::class.java ) { - override fun inspectionText(element: KtCallableDeclaration) = "@Deprecated annotation without 'replaceWith' argument" + override fun inspectionText(element: KtCallableDeclaration) = KotlinBundle.message("deprecated.annotation.without.replacewith.argument") override fun inspectionHighlightRangeInElement(element: KtCallableDeclaration) = element.annotationEntries.first { it.shortName == DEPRECATED_NAME }.textRangeIn(element) - override val defaultFixText = "Add 'replaceWith' argument to specify replacement pattern" + override val defaultFixText = KotlinBundle.message("add.replacewith.argument.to.specify.replacement.pattern") private class ReplaceWith(val expression: String, vararg val imports: String) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/DestructuringWrongNameInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/DestructuringWrongNameInspection.kt index 1c9def4860c..35d15e60bb9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/DestructuringWrongNameInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/DestructuringWrongNameInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.RenameElementFix import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.destructuringDeclarationVisitor @@ -34,7 +35,7 @@ class DestructuringWrongNameInspection : AbstractKotlinInspection() { val fix = primaryParameterNames.getOrNull(entryIndex)?.let { RenameElementFix(entry, it) } holder.registerProblem( entry, - "Variable name '$variableName' matches the name of a different component", + KotlinBundle.message("variable.name.0.matches.the.name.of.a.different.component", variableName), *listOfNotNull(fix).toTypedArray() ) break diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/EmptyRangeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/EmptyRangeInspection.kt index 399ea242c9e..451d1546932 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/EmptyRangeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/EmptyRangeInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.getArguments import org.jetbrains.kotlin.psi.KtExpression @@ -30,14 +31,14 @@ class EmptyRangeInspection : AbstractPrimitiveRangeToInspection() { holder.registerProblem( expression, - "This range is empty. Did you mean to use 'downTo'?", + KotlinBundle.message("this.range.is.empty.did.you.mean.to.use.downto"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithDownToFix() ) } class ReplaceWithDownToFix : LocalQuickFix { - override fun getName() = "Replace with 'downTo'" + override fun getName() = KotlinBundle.message("replace.with.down.to.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt index 5405a1458a2..bb43b2f1639 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/EqualsOrHashCodeInspection.kt @@ -13,6 +13,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.actions.generate.KotlinGenerateEqualsAndHashcodeAction import org.jetbrains.kotlin.idea.actions.generate.findDeclaredEquals import org.jetbrains.kotlin.idea.actions.generate.findDeclaredHashCode @@ -24,7 +25,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType import org.jetbrains.kotlin.resolve.source.getPsi object DeleteEqualsAndHashCodeFix : LocalQuickFix { - override fun getName() = "Delete equals()/hashCode()" + override fun getName() = KotlinBundle.message("delete.equals.and.hash.code.fix.text") override fun getFamilyName() = name @@ -39,11 +40,11 @@ object DeleteEqualsAndHashCodeFix : LocalQuickFix { sealed class GenerateEqualsOrHashCodeFix : LocalQuickFix { object Equals : GenerateEqualsOrHashCodeFix() { - override fun getName() = "Generate 'equals()'" + override fun getName() = InspectionsBundle.message("inspection.equals.hashcode.generate.equals.quickfix") } object HashCode : GenerateEqualsOrHashCodeFix() { - override fun getName() = "Generate 'hashCode()'" + override fun getName() = InspectionsBundle.message("inspection.equals.hashcode.generate.hashcode.quickfix") } override fun getFamilyName() = name @@ -68,7 +69,11 @@ class EqualsOrHashCodeInspection : AbstractKotlinInspection() { when (classDescriptor.kind) { ClassKind.OBJECT -> { if (classOrObject.superTypeListEntries.isNotEmpty()) return - holder.registerProblem(nameIdentifier, "equals()/hashCode() in object declaration", DeleteEqualsAndHashCodeFix) + holder.registerProblem( + nameIdentifier, + KotlinBundle.message("equals.hashcode.in.object.declaration"), + DeleteEqualsAndHashCodeFix + ) } ClassKind.CLASS -> { if (hasEquals && hasHashCode) return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt index a27b5bc207f..fbe0048843a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ExplicitThisInspection.kt @@ -24,6 +24,7 @@ import com.intellij.openapi.project.Project import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.VariableDescriptor import org.jetbrains.kotlin.descriptors.impl.LocalVariableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.getCallableDescriptor import org.jetbrains.kotlin.idea.references.mainReference @@ -42,7 +43,7 @@ class ExplicitThisInspection : AbstractKotlinInspection() { if (hasExplicitThis(expression)) { holder.registerProblem( thisExpression, - "Redundant explicit this", + KotlinBundle.message("redundant.explicit.this"), LIKE_UNUSED_SYMBOL, ExplicitThisExpressionFix(thisExpression.text) ) @@ -108,7 +109,7 @@ class ExplicitThisInspection : AbstractKotlinInspection() { } class ExplicitThisExpressionFix(private val text: String) : LocalQuickFix { - override fun getFamilyName(): String = "Remove redundant '$text'" + override fun getFamilyName(): String = KotlinBundle.message("explicit.this.expression.fix.family.name", text) override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val thisExpression = descriptor.psiElement as? KtThisExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/FakeJvmFieldConstantInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/FakeJvmFieldConstantInspection.kt index ad4b75655b5..575eecdbfdf 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/FakeJvmFieldConstantInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/FakeJvmFieldConstantInspection.kt @@ -22,6 +22,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.* import org.jetbrains.kotlin.asJava.elements.KtLightFieldForSourceDeclarationSupport +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.inspections.MayBeConstantInspection.Status.* import org.jetbrains.kotlin.idea.quickfix.AddConstModifierFix import org.jetbrains.kotlin.psi.KtProperty @@ -98,7 +99,7 @@ class FakeJvmFieldConstantInspection : AbstractKotlinInspection() { } holder.registerProblem( valueExpression, - "Use of non-const Kotlin property as Java constant is incorrect. Will be forbidden in 1.4", + KotlinBundle.message("use.of.non.const.kotlin.property.as.java.constant.is.incorrect.will.be.forbidden.in.1.4"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, *fixes.toTypedArray() ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/FoldInitializerAndIfToElvisInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/FoldInitializerAndIfToElvisInspection.kt index fb61aeb49b0..36978558d68 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/FoldInitializerAndIfToElvisInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/FoldInitializerAndIfToElvisInspection.kt @@ -14,6 +14,7 @@ import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.search.LocalSearchScope import com.intellij.psi.search.searches.ReferencesSearch import org.jetbrains.kotlin.descriptors.VariableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.core.replaced @@ -38,9 +39,9 @@ import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull class FoldInitializerAndIfToElvisInspection : AbstractApplicabilityBasedInspection(KtIfExpression::class.java) { - override fun inspectionText(element: KtIfExpression): String = "If-Null return/break/... foldable to '?:'" + override fun inspectionText(element: KtIfExpression): String = KotlinBundle.message("if.null.return.break.foldable.to") - override val defaultFixText: String = "Replace 'if' with elvis operator" + override val defaultFixText: String = KotlinBundle.message("replace.if.with.elvis.operator") override fun inspectionHighlightRangeInElement(element: KtIfExpression) = element.fromIfKeywordToRightParenthesisTextRangeInThis() diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ForEachParameterNotUsedInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ForEachParameterNotUsedInspection.kt index 766cd083449..23bd50037e2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ForEachParameterNotUsedInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ForEachParameterNotUsedInspection.kt @@ -14,6 +14,7 @@ import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.VariableDescriptor import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl.WithDestructuringDeclaration +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParentheses @@ -59,7 +60,7 @@ class ForEachParameterNotUsedInspection : AbstractKotlinInspection() { fixes += IntroduceAnonymousParameterFix() holder.registerProblem( calleeExpression, - "Loop parameter '${iterableParameter.getThisLabelName()}' is unused", + KotlinBundle.message("loop.parameter.0.is.unused", iterableParameter.getThisLabelName()), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, *fixes.toTypedArray() ) @@ -70,7 +71,7 @@ class ForEachParameterNotUsedInspection : AbstractKotlinInspection() { } private class IntroduceAnonymousParameterFix : LocalQuickFix { - override fun getFamilyName() = "Introduce anonymous parameter" + override fun getFamilyName() = KotlinBundle.message("introduce.anonymous.parameter.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val callExpression = descriptor.psiElement.parent as? KtCallExpression ?: return @@ -84,7 +85,7 @@ class ForEachParameterNotUsedInspection : AbstractKotlinInspection() { } private class ReplaceWithRepeatFix : LocalQuickFix { - override fun getFamilyName() = "Replace with 'repeat()'" + override fun getFamilyName() = KotlinBundle.message("replace.with.repeat.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val callExpression = descriptor.psiElement.parent as? KtCallExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/FunctionWithLambdaExpressionBodyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/FunctionWithLambdaExpressionBodyInspection.kt index db527df073d..6b79856c89f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/FunctionWithLambdaExpressionBodyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/FunctionWithLambdaExpressionBodyInspection.kt @@ -11,6 +11,7 @@ import com.intellij.psi.PsiComment import com.intellij.psi.PsiElement import com.intellij.psi.search.searches.ReferencesSearch import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.core.setType @@ -59,7 +60,7 @@ class FunctionWithLambdaExpressionBodyInspection : AbstractKotlinInspection() { ) holder.registerProblem( lambda, - "Function with `= { ... }` and inferred return type", + KotlinBundle.message("function.with.and.inferred.return.type"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, *fixes.toTypedArray() ) @@ -71,7 +72,7 @@ class FunctionWithLambdaExpressionBodyInspection : AbstractKotlinInspection() { } private class RemoveBracesFix : LocalQuickFix { - override fun getName() = "Remove braces" + override fun getName() = KotlinBundle.message("remove.braces.fix.text") override fun getFamilyName() = name @@ -84,7 +85,7 @@ class FunctionWithLambdaExpressionBodyInspection : AbstractKotlinInspection() { } private class WrapRunFix : LocalQuickFix { - override fun getName() = "Convert to run { ... }" + override fun getName() = KotlinBundle.message("wrap.run.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt index 3e1aee4127b..8667ab190ae 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/HasPlatformTypeInspection.kt @@ -19,6 +19,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.LocalQuickFix import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention import org.jetbrains.kotlin.idea.intentions.isFlexibleRecursive import org.jetbrains.kotlin.idea.quickfix.AddExclExclCallFix @@ -43,8 +44,9 @@ class HasPlatformTypeInspection( } ) { - override val problemText = "Declaration has type inferred from a platform call, which can lead to unchecked nullability issues. " + - "Specify type explicitly as nullable or non-nullable." + override val problemText = KotlinBundle.message( + "declaration.has.type.inferred.from.a.platform.call.which.can.lead.to.unchecked.nullability.issues" + ) override fun additionalFixes(element: KtCallableDeclaration): List? { val type = SpecifyTypeExplicitlyIntention.dangerousFlexibleTypeOrNull( @@ -65,8 +67,8 @@ class HasPlatformTypeInspection( override fun createOptionsPanel(): JComponent? { val panel = MultipleCheckboxOptionsPanel(this) - panel.addCheckbox("Apply only to public or protected members", "publicAPIOnly") - panel.addCheckbox("Report for types with platform arguments", "reportPlatformArguments") + panel.addCheckbox(KotlinBundle.message("apply.only.to.public.or.protected.members"), "publicAPIOnly") + panel.addCheckbox(KotlinBundle.message("report.for.types.with.platform.arguments"), "reportPlatformArguments") return panel } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitThisInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitThisInspection.kt index 1cfe26be3e6..df2235c208c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitThisInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ImplicitThisInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.getCallableDescriptor import org.jetbrains.kotlin.idea.util.getFactoryForImplicitReceiverWithSubtypeOf @@ -50,7 +51,12 @@ class ImplicitThisInspection : AbstractKotlinInspection() { val receiverText = if (expressionFactory.isImmediate) "this" else expressionFactory.expressionText val fix = fixFactory(receiverText) - holder.registerProblem(expression, "Add explicit '$receiverText'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, fix) + holder.registerProblem( + expression, + KotlinBundle.message("callable.reference.fix.family.name", receiverText), + ProblemHighlightType.GENERIC_ERROR_OR_WARNING, + fix + ) } private fun KtExpression.isSelectorOfDotQualifiedExpression(): Boolean { @@ -60,7 +66,7 @@ class ImplicitThisInspection : AbstractKotlinInspection() { } private class CallFix(private val receiverText: String) : LocalQuickFix { - override fun getFamilyName() = "Add explicit '$receiverText'" + override fun getFamilyName() = KotlinBundle.message("callable.reference.fix.family.name", receiverText) override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val expression = descriptor.psiElement as? KtExpression ?: return @@ -72,7 +78,7 @@ class ImplicitThisInspection : AbstractKotlinInspection() { } private class CallableReferenceFix(private val receiverText: String) : LocalQuickFix { - override fun getFamilyName() = "Add explicit '$receiverText'" + override fun getFamilyName() = KotlinBundle.message("callable.reference.fix.family.name", receiverText) override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val expression = descriptor.psiElement as? KtCallableReferenceExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodInspection.kt index e18d55bdf73..e1550a1185b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodInspection.kt @@ -14,6 +14,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.ApiVersion +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.imports.importableFqName import org.jetbrains.kotlin.idea.intentions.callExpression @@ -32,7 +33,7 @@ class JavaCollectionsStaticMethodInspection : AbstractKotlinInspection() { val (methodName, firstArg) = getTargetMethodOnMutableList(expression) ?: return holder.registerProblem( expression, - "Java Collections static method call should be replaced with Kotlin stdlib", + KotlinBundle.message("java.collections.static.method.call.should.be.replaced.with.kotlin.stdlib"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithStdLibFix(methodName, firstArg.text) ) @@ -101,7 +102,7 @@ private fun KotlinType.isListOrSubtype(): Boolean { } private class ReplaceWithStdLibFix(private val methodName: String, private val receiver: String) : LocalQuickFix { - override fun getName() = "Replace with $receiver.$methodName" + override fun getName() = KotlinBundle.message("replace.with.std.lib.fix.text", receiver, methodName) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodOnImmutableListInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodOnImmutableListInspection.kt index ef2cd4854a2..55401fac159 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodOnImmutableListInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/JavaCollectionsStaticMethodOnImmutableListInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.callExpression import org.jetbrains.kotlin.psi.dotQualifiedExpressionVisitor @@ -16,7 +17,7 @@ class JavaCollectionsStaticMethodOnImmutableListInspection : AbstractKotlinInspe val (methodName, firstArg) = JavaCollectionsStaticMethodInspection.getTargetMethodOnImmutableList(expression) ?: return holder.registerProblem( expression.callExpression?.calleeExpression ?: expression, - "Call of Java mutator '$methodName' on immutable Kotlin collection '${firstArg.text}'" + KotlinBundle.message("call.of.java.mutator.0.on.immutable.kotlin.collection.1", methodName, firstArg.text) ) }) } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/JavaMapForEachInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/JavaMapForEachInspection.kt index 1c71c979eeb..d1499ce3351 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/JavaMapForEachInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/JavaMapForEachInspection.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.builtins.DefaultBuiltIns +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.getLastLambdaExpression import org.jetbrains.kotlin.idea.inspections.collections.isMap @@ -43,9 +44,10 @@ class JavaMapForEachInspection : AbstractApplicabilityBasedInspection? { if (isOnTheFly || file !is KtFile || !ProjectRootsUtil.isInProjectSource(file)) { @@ -134,7 +135,7 @@ class KotlinCleanupInspection : LocalInspectionTool(), CleanupLocalInspectionToo } private class RemoveImportFix(import: KtImportDirective) : KotlinQuickFixAction(import), CleanupFix { - override fun getFamilyName() = "Remove deprecated symbol import" + override fun getFamilyName() = KotlinBundle.message("remove.deprecated.symbol.import") override fun getText() = familyName override fun invoke(project: Project, editor: Editor?, file: KtFile) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCovariantEqualsInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCovariantEqualsInspection.kt index 4b00cb8079d..e74b82d2097 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCovariantEqualsInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinCovariantEqualsInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor import org.jetbrains.kotlin.lexer.KtTokens @@ -36,7 +37,7 @@ class KotlinCovariantEqualsInspection : AbstractKotlinInspection() { if (classOrObject.body?.children?.any { (it as? KtNamedFunction)?.isEquals() == true } == true) return - holder.registerProblem(nameIdentifier, "'equals' should take 'Any?' as its argument") + holder.registerProblem(nameIdentifier, KotlinBundle.message("equals.should.take.any.as.its.argument")) }) private fun KtNamedFunction.isEquals(): Boolean { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinDoubleNegationInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinDoubleNegationInspection.kt index caca0a4a2cb..8af67b13dd8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinDoubleNegationInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinDoubleNegationInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.* import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.lexer.KtTokens @@ -31,7 +32,7 @@ class KotlinDoubleNegationInspection : AbstractKotlinInspection(), CleanupLocalI if (parent is KtPrefixExpression && parent.operationToken == KtTokens.EXCL) { holder.registerProblem( expression, - "Redundant double negation", + KotlinBundle.message("redundant.double.negation"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, DoubleNegationFix() ) @@ -39,7 +40,7 @@ class KotlinDoubleNegationInspection : AbstractKotlinInspection(), CleanupLocalI }) private class DoubleNegationFix : LocalQuickFix { - override fun getName() = "Remove redundant negations" + override fun getName() = KotlinBundle.message("double.negation.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinEqualsBetweenInconvertibleTypesInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinEqualsBetweenInconvertibleTypesInspection.kt index f002be94526..774502822f5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinEqualsBetweenInconvertibleTypesInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinEqualsBetweenInconvertibleTypesInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtSimpleNameExpression @@ -27,7 +28,7 @@ class KotlinEqualsBetweenInconvertibleTypesInspection : AbstractKotlinInspection val receiver = call.getQualifiedExpressionForSelector()?.receiverExpression ?: return val argument = call.valueArguments.singleOrNull()?.getArgumentExpression() ?: return if (call.analyze(BodyResolveMode.PARTIAL).isInconvertibleTypes(receiver, argument)) { - holder.registerProblem(callee, "'equals()' between objects of inconvertible types") + holder.registerProblem(callee, KotlinBundle.message("equals.between.objects.of.inconvertible.types")) } }) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinInternalInJavaInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinInternalInJavaInspection.kt index d9b691ca664..262133908a1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinInternalInJavaInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinInternalInJavaInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.LocalInspectionTool import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.* import org.jetbrains.kotlin.asJava.elements.KtLightElement +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.util.module import org.jetbrains.kotlin.lexer.KtTokens.INTERNAL_KEYWORD import org.jetbrains.kotlin.psi.KtModifierListOwner @@ -35,7 +36,7 @@ class KotlinInternalInJavaInspection : LocalInspectionTool() { } if (modifierListOwner.hasModifier(INTERNAL_KEYWORD)) { - holder.registerProblem(this, "Usage of Kotlin internal declaration from different module") + holder.registerProblem(this, KotlinBundle.message("usage.of.kotlin.internal.declaration.from.different.module")) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinJUnitStaticEntryPoint.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinJUnitStaticEntryPoint.kt index 9598bba4769..46d47227aee 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinJUnitStaticEntryPoint.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinJUnitStaticEntryPoint.kt @@ -14,9 +14,10 @@ import com.intellij.openapi.util.DefaultJDOMExternalizer import com.intellij.psi.PsiElement import com.intellij.psi.PsiMethod import org.jdom.Element +import org.jetbrains.kotlin.idea.KotlinBundle class KotlinJUnitStaticEntryPoint(@JvmField var wasSelected: Boolean = true) : EntryPoint() { - override fun getDisplayName() = "JUnit static methods" + override fun getDisplayName() = KotlinBundle.message("junit.static.methods") override fun isSelected() = wasSelected diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt index 6e6b500e9d5..c71e653f24e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinRedundantOverrideInspection.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.lexer.KtTokens @@ -67,7 +68,7 @@ class KotlinRedundantOverrideInspection : AbstractKotlinInspection(), CleanupLoc val descriptor = holder.manager.createProblemDescriptor( function, TextRange(modifierList.startOffsetInParent, funKeyword.endOffset - function.startOffset), - "Redundant overriding method", + KotlinBundle.message("redundant.overriding.method"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly, RedundantOverrideFix() @@ -109,7 +110,7 @@ class KotlinRedundantOverrideInspection : AbstractKotlinInspection(), CleanupLoc } private class RedundantOverrideFix : LocalQuickFix { - override fun getName() = "Remove redundant overriding method" + override fun getName() = KotlinBundle.message("redundant.override.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinThrowableNotThrownInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinThrowableNotThrownInspection.kt index c8b795795f9..c37c3342ec5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinThrowableNotThrownInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinThrowableNotThrownInspection.kt @@ -12,6 +12,7 @@ import com.siyeh.ig.psiutils.TestUtils import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ConstructorDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.psi.* @@ -35,9 +36,9 @@ class KotlinThrowableNotThrownInspection : AbstractKotlinInspection() { if (callExpression.isUsed()) return val description = if (resultingDescriptor is ConstructorDescriptor) { - "Throwable instance '${calleeExpression.text}' is not thrown" + KotlinBundle.message("throwable.instance.0.is.not.thrown", calleeExpression.text) } else { - "Result of '${calleeExpression.text}' call is not thrown" + KotlinBundle.message("result.of.0.call.is.not.thrown", calleeExpression.text) } holder.registerProblem(calleeExpression, description, ProblemHighlightType.GENERIC_ERROR_OR_WARNING) }) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt index f8294465544..ae0bdbaaf73 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/KotlinUnusedImportInspection.kt @@ -40,6 +40,7 @@ import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.util.PsiModificationTracker import com.intellij.psi.util.PsiUtilBase import com.intellij.util.DocumentUtil +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.codeInsight.KotlinCodeInsightWorkspaceSettings import org.jetbrains.kotlin.idea.core.targetDescriptors @@ -124,7 +125,7 @@ class KotlinUnusedImportInspection : AbstractKotlinInspection() { } manager.createProblemDescriptor( it, - "Unused import directive", + KotlinBundle.message("unused.import.directive"), isOnTheFly, fixes.toTypedArray(), ProblemHighlightType.LIKE_UNUSED_SYMBOL @@ -220,7 +221,7 @@ class KotlinUnusedImportInspection : AbstractKotlinInspection() { } private class OptimizeImportsQuickFix(file: KtFile) : LocalQuickFixOnPsiElement(file) { - override fun getText() = "Optimize imports" + override fun getText() = KotlinBundle.message("optimize.imports") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/LateinitVarOverridesLateinitVarInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/LateinitVarOverridesLateinitVarInspection.kt index cc399012cd3..dde95d92b44 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/LateinitVarOverridesLateinitVarInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/LateinitVarOverridesLateinitVarInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtProperty @@ -24,7 +25,7 @@ class LateinitVarOverridesLateinitVarInspection : AbstractKotlinInspection() { if (descriptor.overriddenDescriptors.any { (it as? PropertyDescriptor)?.let { d -> d.isLateInit && d.isVar } == true }) { holder.registerProblem( identifier, - "lateinit var overrides lateinit var" + KotlinBundle.message("lateinit.var.overrides.lateinit.var") ) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt index f66bb303dbb..f1fd9e7a110 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/LeakingThisInspection.kt @@ -14,6 +14,7 @@ import com.intellij.psi.PsiElementVisitor import com.intellij.psi.search.searches.DefinitionsScopedSearch import org.jetbrains.kotlin.cfg.LeakingThisDescriptor.* import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent import org.jetbrains.kotlin.idea.quickfix.AddModifierFix import org.jetbrains.kotlin.lexer.KtTokens @@ -40,21 +41,21 @@ class LeakingThisInspection : AbstractKotlinInspection() { if (expression is KtThisExpression && expression.getStrictParentOfType() == null) { val name = leakingThisDescriptor.klass.name klass.createDescription( - "Leaking 'this' in constructor of non-final class $name", - "Leaking 'this' in constructor of enum class $name (with overridable members)" + KotlinBundle.message("leaking.this.in.constructor.of.non.final.class.0", name), + KotlinBundle.message("leaking.this.in.constructor.of.enum.class.0.with.overridable.members", name) ) { it.hasOverriddenMember() } ?: continue@these } else { continue@these // Not supported yet } is NonFinalProperty -> { val name = leakingThisDescriptor.property.name.asString() - klass.createDescription("Accessing non-final property $name in constructor") { + klass.createDescription(KotlinBundle.message("accessing.non.final.property.0.in.constructor", name)) { it.hasOverriddenMember { owner -> owner.name == name } } ?: continue@these } is NonFinalFunction -> { val function = leakingThisDescriptor.function - klass.createDescription("Calling non-final function ${function.name} in constructor") { + klass.createDescription(KotlinBundle.message("calling.non.final.function.0.in.constructor", function.name)) { it.hasOverriddenMember { owner -> owner is KtNamedFunction && owner.name == function.name.asString() && diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/LiftReturnOrAssignmentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/LiftReturnOrAssignmentInspection.kt index 27b0681195e..0458ad8472a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/LiftReturnOrAssignmentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/LiftReturnOrAssignmentInspection.kt @@ -21,6 +21,7 @@ import com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING import com.intellij.codeInspection.ProblemHighlightType.INFORMATION import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.branchedTransformations.BranchedFoldingUtils import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isElseIf @@ -62,11 +63,11 @@ class LiftReturnOrAssignmentInspection @JvmOverloads constructor(private val ski highlightElement: PsiElement = keyword, highlightType: ProblemHighlightType = if (isSerious) GENERIC_ERROR_OR_WARNING else INFORMATION ) { - val subject = if (fix is LiftReturnOutFix) "Return" else "Assignment" - val verb = if (isSerious) "should" else "can" + val subject = if (fix is LiftReturnOutFix) KotlinBundle.message("text.Return") else KotlinBundle.message("text.Assignment") + val verb = if (isSerious) KotlinBundle.message("text.should") else KotlinBundle.message("text.can") holder.registerProblemWithoutOfflineInformation( expression, - "$subject $verb be lifted out of '${keyword.text}'", + KotlinBundle.message("0.1.be.lifted.out.of.2", subject, verb, keyword.text), isOnTheFly, highlightType, highlightElement.textRange?.shiftRight(-expression.startOffset), @@ -77,7 +78,7 @@ class LiftReturnOrAssignmentInspection @JvmOverloads constructor(private val ski } private class LiftReturnOutFix(private val keyword: String) : LocalQuickFix { - override fun getName() = "Lift return out of '$keyword'" + override fun getName() = KotlinBundle.message("lift.return.out.fix.text.0", keyword) override fun getFamilyName() = name @@ -88,7 +89,7 @@ class LiftReturnOrAssignmentInspection @JvmOverloads constructor(private val ski } private class LiftAssignmentOutFix(private val keyword: String) : LocalQuickFix { - override fun getName() = "Lift assignment out of '$keyword'" + override fun getName() = KotlinBundle.message("lift.assignment.out.fix.text.0", keyword) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MainFunctionReturnUnitInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MainFunctionReturnUnitInspection.kt index 3d55ae5940e..594ab0b26f4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MainFunctionReturnUnitInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MainFunctionReturnUnitInspection.kt @@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.MainFunctionDetector import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny @@ -48,7 +49,7 @@ class MainFunctionReturnUnitInspection : AbstractKotlinInspection() { holder.registerProblem( function.nameIdentifier ?: function, - "${if (isMain) "main" else "JUnit test"} should return Unit", + KotlinBundle.message("0.should.return.unit", if (isMain) "main" else KotlinBundle.message("junit.test")), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ChangeMainFunctionReturnTypeToUnitFix(function.typeReference != null) ) @@ -63,7 +64,10 @@ private fun KtAnnotationEntry.fqName(): FqName? { } private class ChangeMainFunctionReturnTypeToUnitFix(private val hasExplicitReturnType: Boolean) : LocalQuickFix { - override fun getName() = if (hasExplicitReturnType) "Change return type to Unit" else "Add explicit Unit return type" + override fun getName() = if (hasExplicitReturnType) + KotlinBundle.message("change.main.function.return.type.to.unit.fix.text2") + else + KotlinBundle.message("change.main.function.return.type.to.unit.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MapGetWithNotNullAssertionOperatorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MapGetWithNotNullAssertionOperatorInspection.kt index 5ba724ae77c..d96ba9c2261 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MapGetWithNotNullAssertionOperatorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MapGetWithNotNullAssertionOperatorInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiDocumentManager +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.intentions.callExpression @@ -29,7 +30,7 @@ class MapGetWithNotNullAssertionOperatorInspection : AbstractKotlinInspection() if (expression.baseExpression?.resolveToCall()?.resultingDescriptor?.fqNameSafe != FqName("kotlin.collections.Map.get")) return holder.registerProblem( expression.operationReference, - "map.get() with not-null assertion operator (!!)", + KotlinBundle.message("map.get.with.not.null.assertion.operator"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithGetValueCallFix(), ReplaceWithGetOrElseFix(), @@ -38,7 +39,7 @@ class MapGetWithNotNullAssertionOperatorInspection : AbstractKotlinInspection() }) private class ReplaceWithGetValueCallFix : LocalQuickFix { - override fun getName() = "Replace with 'getValue' call" + override fun getName() = KotlinBundle.message("replace.with.get.value.call.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val expression = descriptor.psiElement.parent as? KtPostfixExpression ?: return @@ -49,7 +50,7 @@ class MapGetWithNotNullAssertionOperatorInspection : AbstractKotlinInspection() } private class ReplaceWithGetOrElseFix : LocalQuickFix { - override fun getName() = "Replace with 'getOrElse' call" + override fun getName() = KotlinBundle.message("replace.with.get.or.else.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val expression = descriptor.psiElement.parent as? KtPostfixExpression ?: return @@ -66,7 +67,7 @@ class MapGetWithNotNullAssertionOperatorInspection : AbstractKotlinInspection() } private class ReplaceWithElvisErrorFix : LocalQuickFix { - override fun getName() = "Replace with '?: error(\"\")'" + override fun getName() = KotlinBundle.message("replace.with.elvis.error.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val expression = descriptor.psiElement.parent as? KtPostfixExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MayBeConstantInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MayBeConstantInspection.kt index b16689702cd..eebb3b780ff 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MayBeConstantInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MayBeConstantInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.VariableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.inspections.MayBeConstantInspection.Status.* import org.jetbrains.kotlin.idea.quickfix.AddConstModifierFix @@ -47,7 +48,10 @@ class MayBeConstantInspection : AbstractKotlinInspection() { MIGHT_BE_CONST, JVM_FIELD_MIGHT_BE_CONST -> { holder.registerProblem( property.nameIdentifier ?: property, - if (status == JVM_FIELD_MIGHT_BE_CONST) "'const' might be used instead of '@JvmField'" else "Might be 'const'", + if (status == JVM_FIELD_MIGHT_BE_CONST) + KotlinBundle.message("const.might.be.used.instead.of.jvmfield") + else + KotlinBundle.message("might.be.const"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, IntentionWrapper(AddConstModifierFix(property), property.containingFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MemberVisibilityCanBePrivateInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MemberVisibilityCanBePrivateInspection.kt index f1f6afb8609..f5c9e09a000 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MemberVisibilityCanBePrivateInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MemberVisibilityCanBePrivateInspection.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithVisibility import org.jetbrains.kotlin.descriptors.EffectiveVisibility import org.jetbrains.kotlin.descriptors.effectiveVisibility +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.core.canBePrivate import org.jetbrains.kotlin.idea.core.isInheritable @@ -150,13 +151,13 @@ class MemberVisibilityCanBePrivateInspection : AbstractKotlinInspection() { private fun registerProblem(holder: ProblemsHolder, declaration: KtDeclaration) { val modifierListOwner = declaration.getParentOfType(false) ?: return val member = when (declaration) { - is KtNamedFunction -> "Function" - else -> "Property" + is KtNamedFunction -> KotlinBundle.message("text.Function") + else -> KotlinBundle.message("text.Property") } val nameElement = (declaration as? PsiNameIdentifierOwner)?.nameIdentifier ?: return holder.registerProblem( declaration.visibilityModifier() ?: nameElement, - "$member '${declaration.getName()}' could be private", + KotlinBundle.message("0.1.could.be.private", member, declaration.getName().toString()), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, IntentionWrapper(AddModifierFix(modifierListOwner, KtTokens.PRIVATE_KEYWORD), declaration.containingKtFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt index 7a057bf5a6b..89d82fbed1e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MigrateDiagnosticSuppressionInspection.kt @@ -13,6 +13,7 @@ import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.diagnostics.DiagnosticFactory import org.jetbrains.kotlin.diagnostics.Errors.* +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtPsiFactory import org.jetbrains.kotlin.psi.KtStringTemplateExpression @@ -36,7 +37,7 @@ class MigrateDiagnosticSuppressionInspection : AbstractKotlinInspection(), Clean holder.registerProblem( expression, - "Diagnostic name should be replaced by the new one", + KotlinBundle.message("diagnostic.name.should.be.replaced.by.the.new.one"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceDiagnosticNameFix(newDiagnosticFactory) ) @@ -45,9 +46,9 @@ class MigrateDiagnosticSuppressionInspection : AbstractKotlinInspection(), Clean } class ReplaceDiagnosticNameFix(private val diagnosticFactory: DiagnosticFactory<*>) : LocalQuickFix { - override fun getName() = "$familyName with ${diagnosticFactory.name}" + override fun getName() = KotlinBundle.message("replace.diagnostic.name.fix.text", familyName, diagnosticFactory.name) - override fun getFamilyName() = "Replace diagnostic name" + override fun getFamilyName() = KotlinBundle.message("replace.diagnostic.name.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val expression = descriptor.psiElement as? KtStringTemplateExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveLambdaOutsideParenthesesInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveLambdaOutsideParenthesesInspection.kt index 10750a52dea..254dcbd3a0c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveLambdaOutsideParenthesesInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveLambdaOutsideParenthesesInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemHighlightType import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.canMoveLambdaOutsideParentheses import org.jetbrains.kotlin.idea.core.getLastLambdaExpression import org.jetbrains.kotlin.idea.core.moveFunctionLiteralOutsideParentheses @@ -27,7 +28,7 @@ class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspect } private val KtCallExpression.verb: String - get() = if (withInformationLevel()) "can" else "should" + get() = if (withInformationLevel()) KotlinBundle.message("text.can") else KotlinBundle.message("text.should") override fun inspectionHighlightType(element: KtCallExpression): ProblemHighlightType = if (element.withInformationLevel()) ProblemHighlightType.INFORMATION else ProblemHighlightType.GENERIC_ERROR_OR_WARNING @@ -40,11 +41,11 @@ class MoveLambdaOutsideParenthesesInspection : AbstractApplicabilityBasedInspect } } - override fun inspectionText(element: KtCallExpression) = "Lambda argument ${element.verb} be moved out of parentheses" + override fun inspectionText(element: KtCallExpression) = KotlinBundle.message("lambda.argument.0.be.moved.out", element.verb) override fun inspectionHighlightRangeInElement(element: KtCallExpression) = element.getLastLambdaExpression() ?.getStrictParentOfType()?.asElement() ?.textRangeIn(element) - override val defaultFixText = "Move lambda argument out of parentheses" + override val defaultFixText = KotlinBundle.message("move.lambda.argument.out.of.parentheses") } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt index 5d6efd2a0eb..50a1e73415c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveSuspiciousCallableReferenceIntoParenthesesInspection.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.descriptors.VariableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny @@ -59,7 +60,7 @@ class MoveSuspiciousCallableReferenceIntoParenthesesInspection : AbstractKotlinI null holder.registerProblem( lambdaExpression, - "Suspicious callable reference as the only lambda element", + KotlinBundle.message("suspicious.callable.reference.as.the.only.lambda.element"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, quickFix ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveVariableDeclarationIntoWhenInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveVariableDeclarationIntoWhenInspection.kt index 8838e5afe74..a309811b610 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/MoveVariableDeclarationIntoWhenInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/MoveVariableDeclarationIntoWhenInspection.kt @@ -15,6 +15,7 @@ import com.intellij.psi.PsiComment import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.SmartPsiElementPointer +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.moveCaret import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isOneLiner import org.jetbrains.kotlin.idea.intentions.loopToCallChain.countUsages @@ -55,14 +56,14 @@ private enum class Action { val description: String get() = when (this) { - MOVE -> "Variable declaration could be moved into `when`" - INLINE -> "Variable declaration could be inlined" - NOTHING -> "Nothing to do" + MOVE -> KotlinBundle.message("variable.declaration.could.be.moved.into.when") + INLINE -> KotlinBundle.message("variable.declaration.could.be.inlined") + NOTHING -> KotlinBundle.message("nothing.to.do") } fun createFix(subjectExpressionPointer: SmartPsiElementPointer): VariableDeclarationIntoWhenFix = when (this) { - MOVE -> VariableDeclarationIntoWhenFix("Move variable declaration into `when`", subjectExpressionPointer) { it } - INLINE -> VariableDeclarationIntoWhenFix("Inline variable", subjectExpressionPointer) { it.initializer } + MOVE -> VariableDeclarationIntoWhenFix(KotlinBundle.message("move.variable.declaration.into.when"), subjectExpressionPointer) { it } + INLINE -> VariableDeclarationIntoWhenFix(KotlinBundle.message("inline.variable"), subjectExpressionPointer) { it.initializer } else -> error("Illegal action") } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt index 3bdeebb5d01..4f6b7f3ef1a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/NamingConventionInspections.kt @@ -25,6 +25,7 @@ import org.intellij.lang.annotations.Language import org.intellij.lang.regexp.RegExpFileType import org.jdom.Element import org.jetbrains.annotations.NonNls +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.packageMatchesDirectoryOrImplicit import org.jetbrains.kotlin.idea.quickfix.RenameIdentifierFix import org.jetbrains.kotlin.idea.refactoring.isInjectedFragment @@ -48,35 +49,35 @@ private fun findRuleMessage(checkString: String, rules: Array): return null } -private val START_UPPER = NamingRule("should start with an uppercase letter") { +private val START_UPPER = NamingRule(KotlinBundle.message("should.start.with.an.uppercase.letter")) { it.getOrNull(0)?.isUpperCase() == false } -private val START_LOWER = NamingRule("should start with a lowercase letter") { +private val START_LOWER = NamingRule(KotlinBundle.message("should.start.with.a.lowercase.letter")) { it.getOrNull(0)?.isLowerCase() == false } -private val NO_UNDERSCORES = NamingRule("should not contain underscores") { +private val NO_UNDERSCORES = NamingRule(KotlinBundle.message("should.not.contain.underscores")) { '_' in it } -private val NO_START_UPPER = NamingRule("should not start with an uppercase letter") { +private val NO_START_UPPER = NamingRule(KotlinBundle.message("should.not.start.with.an.uppercase.letter")) { it.getOrNull(0)?.isUpperCase() == true } -private val NO_START_UNDERSCORE = NamingRule("should not start with an underscore") { +private val NO_START_UNDERSCORE = NamingRule(KotlinBundle.message("should.not.start.with.an.underscore")) { it.startsWith('_') } -private val NO_MIDDLE_UNDERSCORES = NamingRule("should not contain underscores in the middle or the end") { +private val NO_MIDDLE_UNDERSCORES = NamingRule(KotlinBundle.message("should.not.contain.underscores.in.the.middle.or.the.end")) { '_' in it.substring(1) } -private val NO_BAD_CHARACTERS = NamingRule("may contain only letters and digits") { +private val NO_BAD_CHARACTERS = NamingRule(KotlinBundle.message("may.contain.only.letters.and.digits")) { it.any { c -> c !in 'a'..'z' && c !in 'A'..'Z' && c !in '0'..'9' } } -private val NO_BAD_CHARACTERS_OR_UNDERSCORE = NamingRule("may contain only letters, digits or underscores") { +private val NO_BAD_CHARACTERS_OR_UNDERSCORE = NamingRule(KotlinBundle.message("may.contain.only.letters.digits.or.underscores")) { it.any { c -> c !in 'a'..'z' && c !in 'A'..'Z' && c !in '0'..'9' && c != '_' } } @@ -106,7 +107,7 @@ class NamingConventionInspectionSettings( val message = getNameMismatchMessage(name) holder.registerProblem( element.nameIdentifier!!, - "$entityName name #ref $message #loc", + "$entityName ${KotlinBundle.message("text.name")}#ref $message #loc", RenameIdentifierFix() ) } @@ -120,7 +121,7 @@ class NamingConventionInspectionSettings( return findRuleMessage(name, rules) ?: getDefaultErrorMessage() } - fun getDefaultErrorMessage() = "doesn't match regex '$namePattern'" + fun getDefaultErrorMessage() = KotlinBundle.message("doesn.t.match.regex.0", namePattern) fun createOptionsPanel(): JPanel = NamingConventionOptionsPanel(this) @@ -136,7 +137,7 @@ class NamingConventionInspectionSettings( settings.namePattern = regexField.text } }) - val labeledComponent = LabeledComponent.create(regexField, "Pattern:", BorderLayout.WEST) + val labeledComponent = LabeledComponent.create(regexField, KotlinBundle.message("text.pattern"), BorderLayout.WEST) add(labeledComponent, BorderLayout.NORTH) } } @@ -329,10 +330,10 @@ private class PackageNameInspectionLocal( data class CheckResult(val errorMessage: String, val isForPart: Boolean) fun CheckResult.toProblemTemplateString(): String { - return if (isForPart) { - "Package name #ref part $errorMessage #loc" + return KotlinBundle.message("package.name") + if (isForPart) { + " #ref ${KotlinBundle.message("text.part")} $errorMessage #loc" } else { - "Package name #ref $errorMessage #loc" + " #ref $errorMessage #loc" } } @@ -378,10 +379,10 @@ class PackageNameInspection : BaseGlobalInspection() { val PART_RULES = arrayOf(NO_BAD_CHARACTERS_OR_UNDERSCORE, NO_START_UPPER) private fun PackageNameInspectionLocal.Companion.CheckResult.toErrorMessage(qualifiedName: String): String { - return if (isForPart) { - "Package name $qualifiedName part $errorMessage" + return KotlinBundle.message("package.name") + if (isForPart) { + " $qualifiedName ${KotlinBundle.message("text.part")} $errorMessage" } else { - "Package name $qualifiedName $errorMessage" + " $qualifiedName $errorMessage" } } } @@ -391,7 +392,7 @@ class PackageNameInspection : BaseGlobalInspection() { var namePattern: String = DEFAULT_PACKAGE_NAME_PATTERN private val namingSettings = NamingConventionInspectionSettings( - "Package", + KotlinBundle.message("text.Package"), DEFAULT_PACKAGE_NAME_PATTERN, setNamePatternCallback = { value -> namePattern = value diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/NestedLambdaShadowedImplicitParameterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/NestedLambdaShadowedImplicitParameterInspection.kt index 8bff2184517..1d497743b66 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/NestedLambdaShadowedImplicitParameterInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/NestedLambdaShadowedImplicitParameterInspection.kt @@ -10,6 +10,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.inspections.collections.isCalling import org.jetbrains.kotlin.idea.intentions.ReplaceItWithExplicitFunctionLiteralParamIntention @@ -52,7 +53,7 @@ class NestedLambdaShadowedImplicitParameterInspection : AbstractKotlinInspection if (it.isImplicitParameterReference(lambda, implicitParameter, context)) { holder.registerProblem( it, - "Implicit parameter 'it' of enclosing lambda is shadowed", + KotlinBundle.message("implicit.parameter.it.of.enclosing.lambda.is.shadowed"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, AddExplicitParameterToOuterLambdaFix(), IntentionWrapper(ReplaceItWithExplicitFunctionLiteralParamIntention(), containingFile) @@ -63,7 +64,7 @@ class NestedLambdaShadowedImplicitParameterInspection : AbstractKotlinInspection } private class AddExplicitParameterToOuterLambdaFix : LocalQuickFix { - override fun getName() = "Add explicit parameter name to outer lambda" + override fun getName() = KotlinBundle.message("add.explicit.parameter.to.outer.lambda.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt index c943ed5678f..00ca9b08f2f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/NullChecksToSafeCallInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInsight.FileModificationService import com.intellij.codeInspection.* import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isStableSimpleExpression @@ -24,7 +25,7 @@ class NullChecksToSafeCallInspection : AbstractKotlinInspection() { if (isNullChecksToSafeCallFixAvailable(expression)) { holder.registerProblem( expression, - "Null-checks replaceable with safe-calls", + KotlinBundle.message("null.checks.replaceable.with.safe.calls"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, NullChecksToSafeCallCheckFix() ) @@ -32,7 +33,7 @@ class NullChecksToSafeCallInspection : AbstractKotlinInspection() { } private class NullChecksToSafeCallCheckFix : LocalQuickFix { - override fun getName() = "Replace chained null-checks with safe-calls" + override fun getName() = KotlinBundle.message("null.checks.to.safe.call.check.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/NullableBooleanElvisInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/NullableBooleanElvisInspection.kt index cfe4611e81a..60d8789be9b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/NullableBooleanElvisInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/NullableBooleanElvisInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType.GENERIC_ERROR_OR_WARNING import com.intellij.codeInspection.ProblemHighlightType.INFORMATION import com.intellij.openapi.project.Project import com.intellij.psi.util.PsiTreeUtil +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.lexer.KtTokens @@ -37,13 +38,13 @@ class NullableBooleanElvisInspection : AbstractKotlinInspection(), CleanupLocalI else -> null } val (highlightType, verb) = if (condition != null && condition in expression.parentsWithSelf) - GENERIC_ERROR_OR_WARNING to "should" + GENERIC_ERROR_OR_WARNING to KotlinBundle.message("text.should") else - INFORMATION to "can" + INFORMATION to KotlinBundle.message("text.can") holder.registerProblemWithoutOfflineInformation( expression, - "Equality check $verb be used instead of elvis for nullable boolean check", + KotlinBundle.message("equality.cehck.0.be.used.instead.of.elvis.for.nullable.boolean.check", verb), isOnTheFly, highlightType, ReplaceWithEqualityCheckFix() @@ -52,7 +53,7 @@ class NullableBooleanElvisInspection : AbstractKotlinInspection(), CleanupLocalI }) private class ReplaceWithEqualityCheckFix : LocalQuickFix { - override fun getName() = "Replace with equality check" + override fun getName() = KotlinBundle.message("replace.with.equality.check.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/OptionalExpectationInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/OptionalExpectationInspection.kt index 5437830a4d2..fcc7e51da48 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/OptionalExpectationInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/OptionalExpectationInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.LocalInspectionToolSession import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.analyzer.ModuleInfo +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.project.ModuleSourceInfo import org.jetbrains.kotlin.idea.caches.project.implementingDescriptors import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor @@ -57,7 +58,11 @@ class OptionalExpectationInspection : AbstractKotlinInspection() { val actualModule = (actualModuleDescriptor.getCapability(ModuleInfo.Capability) as? ModuleSourceInfo)?.module ?: continue holder.registerProblem( classOrObject.nameIdentifier ?: classOrObject, - "Optionally expected annotation has no actual annotation in module $displayedName for platform ${platform.oldFashionedDescription}", + KotlinBundle.message( + "optionally.expected.annotation.has.no.actual.annotation.in.module.0.for.platform.1", + displayedName, + platform.oldFashionedDescription + ), // NB: some highlighting is not suggested for this inspection ProblemHighlightType.INFORMATION, IntentionWrapper(CreateActualClassFix(classOrObject, actualModule, platform), classOrObject.containingFile) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/PlatformExtensionReceiverOfInlineInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/PlatformExtensionReceiverOfInlineInspection.kt index 3dfebc598c1..792413010c8 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/PlatformExtensionReceiverOfInlineInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/PlatformExtensionReceiverOfInlineInspection.kt @@ -16,6 +16,7 @@ import com.intellij.ui.EditorTextField import org.intellij.lang.regexp.RegExpFileType import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.project.languageVersionSettings @@ -77,7 +78,7 @@ class PlatformExtensionReceiverOfInlineInspection : AbstractKotlinInspection() { holder.registerProblem( receiverExpression, - "Call of inline function with nullable extension receiver can provoke NPE in Kotlin 1.2+", + KotlinBundle.message("call.of.inline.function.with.nullable.extension.receiver.can.provoke.npe.in.kotlin.1.2"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, IntentionWrapper(AddExclExclCallFix(receiverExpression), receiverExpression.containingKtFile) ) @@ -98,7 +99,7 @@ class PlatformExtensionReceiverOfInlineInspection : AbstractKotlinInspection() { owner.namePattern = regexField.text } }) - val labeledComponent = LabeledComponent.create(regexField, "Pattern:", BorderLayout.WEST) + val labeledComponent = LabeledComponent.create(regexField, KotlinBundle.message("text.pattern"), BorderLayout.WEST) add(labeledComponent, BorderLayout.NORTH) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ProtectedInFinalInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ProtectedInFinalInspection.kt index 7dd04911300..3ae7cc2e1ed 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ProtectedInFinalInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ProtectedInFinalInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInsight.FileModificationService import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.implicitVisibility import org.jetbrains.kotlin.idea.core.isInheritable import org.jetbrains.kotlin.idea.intentions.isFinalizeMethod @@ -33,7 +34,7 @@ class ProtectedInFinalInspection : AbstractKotlinInspection() { ) { holder.registerProblem( visibilityModifier, - "'protected' visibility is effectively 'private' in a final class", + KotlinBundle.message("protected.visibility.is.effectively.private.in.a.final.class"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, MakePrivateFix(), MakeOpenFix() @@ -44,7 +45,7 @@ class ProtectedInFinalInspection : AbstractKotlinInspection() { } class MakePrivateFix : LocalQuickFix { - override fun getName(): String = "Make private" + override fun getName(): String = KotlinBundle.message("make.private.fix.text") override fun getFamilyName(): String = name @@ -57,7 +58,7 @@ class ProtectedInFinalInspection : AbstractKotlinInspection() { } class MakeOpenFix : LocalQuickFix { - override fun getName(): String = "Make class open" + override fun getName(): String = KotlinBundle.message("make.open.fix.text") override fun getFamilyName(): String = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/PublicApiImplicitTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/PublicApiImplicitTypeInspection.kt index 23797ced24e..51b908f9e3e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/PublicApiImplicitTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/PublicApiImplicitTypeInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel import org.jetbrains.kotlin.config.AnalysisFlags import org.jetbrains.kotlin.config.ExplicitApiMode import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.resolve.checkers.ExplicitApiDeclarationChecker @@ -30,15 +31,15 @@ class PublicApiImplicitTypeInspection( override val problemText: String get() { return if (!reportInternal && !reportPrivate) - "For API stability, it's recommended to specify explicitly public & protected declaration types" + KotlinBundle.message("for.api.stability.it.s.recommended.to.specify.explicitly.public.protected.declaration.types") else - "For API stability, it's recommended to specify explicitly declaration types" + KotlinBundle.message("for.api.stability.it.s.recommended.to.specify.explicitly.declaration.types") } override fun createOptionsPanel(): JComponent? { val panel = MultipleCheckboxOptionsPanel(this) - panel.addCheckbox("Apply also to internal members", "reportInternal") - panel.addCheckbox("Apply also to private members", "reportPrivate") + panel.addCheckbox(KotlinBundle.message("apply.also.to.internal.members"), "reportInternal") + panel.addCheckbox(KotlinBundle.message("apply.also.to.private.members"), "reportPrivate") return panel } } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RecursiveEqualsCallInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RecursiveEqualsCallInspection.kt index caf1468f474..82a540afdf4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RecursiveEqualsCallInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RecursiveEqualsCallInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.conventionNameCalls.isAnyEquals import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor @@ -44,7 +45,7 @@ class RecursiveEqualsCallInspection : AbstractKotlinInspection() { private fun KtExpression.reportRecursiveEquals(invert: Boolean = false) { holder.registerProblem( this, - "Recursive equals call", + KotlinBundle.message("recursive.equals.call"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithReferentialEqualityFix(invert) ) @@ -73,7 +74,7 @@ class RecursiveEqualsCallInspection : AbstractKotlinInspection() { private class ReplaceWithReferentialEqualityFix(invert: Boolean) : LocalQuickFix { private val operator = if (invert) "!==" else "===" - override fun getName() = "Replace with '$operator'" + override fun getName() = KotlinBundle.message("replace.with.0", operator) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RecursivePropertyAccessorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RecursivePropertyAccessorInspection.kt index 8d9724b0c7f..12fd0de43b2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RecursivePropertyAccessorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RecursivePropertyAccessorInspection.kt @@ -11,6 +11,7 @@ import com.intellij.psi.PsiElementVisitor import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -28,14 +29,14 @@ class RecursivePropertyAccessorInspection : AbstractKotlinInspection() { if (isRecursivePropertyAccess(expression)) { holder.registerProblem( expression, - "Recursive property accessor", + KotlinBundle.message("recursive.property.accessor"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithFieldFix() ) } else if (isRecursiveSyntheticPropertyAccess(expression)) { holder.registerProblem( expression, - "Recursive synthetic property accessor", + KotlinBundle.message("recursive.synthetic.property.accessor"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING ) } @@ -44,7 +45,7 @@ class RecursivePropertyAccessorInspection : AbstractKotlinInspection() { class ReplaceWithFieldFix : LocalQuickFix { - override fun getName() = "Replace with 'field'" + override fun getName() = KotlinBundle.message("replace.with.field.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt index 63ebe0da051..d5452493d3b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantCompanionReferenceInspection.kt @@ -12,10 +12,10 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.analysis.analyzeAsReplacement import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor import org.jetbrains.kotlin.idea.util.getResolutionScope import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.load.java.JvmAbi @@ -41,7 +41,7 @@ class RedundantCompanionReferenceInspection : AbstractKotlinInspection() { if (isRedundantCompanionReference(expression)) { holder.registerProblem( expression, - "Redundant Companion reference", + KotlinBundle.message("redundant.companion.reference"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveRedundantCompanionReferenceFix() ) @@ -140,7 +140,7 @@ private fun CallableDescriptor.isLocalOrExtension(extensionClassDescriptor: Clas } class RemoveRedundantCompanionReferenceFix : LocalQuickFix { - override fun getName() = "Remove redundant Companion reference" + override fun getName() = KotlinBundle.message("remove.redundant.companion.reference.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElseInIfInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElseInIfInspection.kt index 5784414c5d7..927bf764111 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElseInIfInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantElseInIfInspection.kt @@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.formatter.adjustLineIndent import org.jetbrains.kotlin.idea.intentions.branchedTransformations.isElseIf @@ -34,7 +35,7 @@ class RedundantElseInIfInspection : AbstractKotlinInspection() { holder.manager.createProblemDescriptor( ifExpression, rangeInElement, - "Redundant 'else'", + KotlinBundle.message("redundant.else"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly, RemoveRedundantElseFix() @@ -44,7 +45,7 @@ class RedundantElseInIfInspection : AbstractKotlinInspection() { } private class RemoveRedundantElseFix : LocalQuickFix { - override fun getName() = "Remove redundant 'else'" + override fun getName() = KotlinBundle.message("remove.redundant.else.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt index 388e603a2e6..fcde30941aa 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEmptyInitializerBlockInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.psi.KtBlockExpression import org.jetbrains.kotlin.psi.KtClassInitializer import org.jetbrains.kotlin.psi.classInitializerVisitor @@ -20,14 +21,14 @@ class RedundantEmptyInitializerBlockInspection : AbstractKotlinInspection() { if (body.statements.isNotEmpty()) return holder.registerProblem( initializer, - "Redundant empty initializer block", + KotlinBundle.message("redundant.empty.initializer.block"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveInitializerBlockFix() ) }) private class RemoveInitializerBlockFix : LocalQuickFix { - override fun getName() = "Remove initializer block" + override fun getName() = KotlinBundle.message("remove.initializer.block.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt index c3936eb348a..675d05163fc 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantEnumConstructorInvocationInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import org.jetbrains.kotlin.diagnostics.Severity +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtEnumEntry import org.jetbrains.kotlin.psi.KtSuperTypeCallEntry @@ -25,7 +26,7 @@ class RedundantEnumConstructorInvocationInspection : AbstractKotlinInspection() val valueArgumentList = enumEntry.valueArgumentListIfEmpty() ?: return holder.registerProblem( valueArgumentList, - "Redundant enum constructor invocation", + KotlinBundle.message("redundant.enum.constructor.invocation"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveEnumConstructorInvocationFix() ) @@ -33,7 +34,7 @@ class RedundantEnumConstructorInvocationInspection : AbstractKotlinInspection() } private class RemoveEnumConstructorInvocationFix : LocalQuickFix { - override fun getName() = "Remove enum constructor invocation" + override fun getName() = KotlinBundle.message("remove.enum.constructor.invocation.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt index 4da76fba803..1ff312f0aec 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantExplicitTypeInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.KtNodeTypes import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeIntention import org.jetbrains.kotlin.psi.* @@ -22,7 +23,7 @@ class RedundantExplicitTypeInspection : AbstractKotlinInspection() { if (hasRedundantType(property)) { holder.registerProblem( typeReference, - "Explicitly given type is redundant here", + KotlinBundle.message("explicitly.given.type.is.redundant.here"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveExplicitTypeIntention(), property.containingKtFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt index 0698b75aa44..088c99bd5c4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.isAncestor @@ -21,7 +22,7 @@ class RedundantGetterInspection : AbstractKotlinInspection(), CleanupLocalInspec if (accessor.isRedundantGetter()) { holder.registerProblem( accessor, - "Redundant getter", + KotlinBundle.message("redundant.getter"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, rangeInElement, RemoveRedundantGetterFix() @@ -62,7 +63,7 @@ fun KtPropertyAccessor.deleteBody() { } class RemoveRedundantGetterFix : LocalQuickFix { - override fun getName() = "Remove redundant getter" + override fun getName() = KotlinBundle.message("remove.redundant.getter.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt index a874a112a8d..bea27035c59 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantIfInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInsight.CodeInsightUtil import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.negate import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -23,7 +24,7 @@ class RedundantIfInspection : AbstractKotlinInspection(), CleanupLocalInspection holder.registerProblem( expression, - "Redundant 'if' statement", + KotlinBundle.message("redundant.if.statement"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, RemoveRedundantIf(redundancyType, branchType) ) @@ -81,7 +82,7 @@ class RedundantIfInspection : AbstractKotlinInspection(), CleanupLocalInspection } private class RemoveRedundantIf(private val redundancyType: RedundancyType, private val branchType: BranchType) : LocalQuickFix { - override fun getName() = "Remove redundant 'if' statement" + override fun getName() = KotlinBundle.message("remove.redundant.if.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt index 1ef7915785c..220476f6149 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLambdaArrowInspection.kt @@ -14,6 +14,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.refactoring.replaceWithCopyWithResolveCheck @@ -68,7 +69,7 @@ class RedundantLambdaArrowInspection : AbstractKotlinInspection() { holder.manager.createProblemDescriptor( functionLiteral, TextRange((singleParameter?.startOffset ?: arrow.startOffset) - startOffset, arrow.endOffset - startOffset), - "Redundant lambda arrow", + KotlinBundle.message("redundant.lambda.arrow"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly, DeleteFix() @@ -78,7 +79,7 @@ class RedundantLambdaArrowInspection : AbstractKotlinInspection() { } class DeleteFix : LocalQuickFix { - override fun getFamilyName() = "Remove arrow" + override fun getFamilyName() = KotlinBundle.message("delete.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val element = descriptor.psiElement as? KtFunctionLiteral ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLetInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLetInspection.kt index 03f4ea042b0..d321c5733db 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLetInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantLetInspection.kt @@ -11,6 +11,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.intentions.* @@ -28,11 +29,11 @@ import org.jetbrains.kotlin.types.isNullable abstract class RedundantLetInspection : AbstractApplicabilityBasedInspection( KtCallExpression::class.java ) { - override fun inspectionText(element: KtCallExpression) = "Redundant `let` call could be removed" + override fun inspectionText(element: KtCallExpression) = KotlinBundle.message("redundant.let.call.could.be.removed") final override fun inspectionHighlightRangeInElement(element: KtCallExpression) = element.calleeExpression?.textRangeIn(element) - final override val defaultFixText = "Remove `let` call" + final override val defaultFixText = KotlinBundle.message("remove.let.call") final override fun isApplicable(element: KtCallExpression): Boolean { if (!element.isLetMethodCall()) return false diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt index c220b9280de..343f2df4982 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantModalityModifierInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.* import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.implicitModality import org.jetbrains.kotlin.idea.quickfix.RemoveModifierFix import org.jetbrains.kotlin.psi.declarationVisitor @@ -23,7 +24,7 @@ class RedundantModalityModifierInspection : AbstractKotlinInspection(), CleanupL holder.registerProblem( modalityModifier, - "Redundant modality modifier", + KotlinBundle.message("redundant.modality.modifier"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper( RemoveModifierFix(declaration, implicitModality, isRedundant = true), diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantNotNullExtensionReceiverOfInlineInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantNotNullExtensionReceiverOfInlineInspection.kt index c2b4b47a0bb..334055e6cf2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantNotNullExtensionReceiverOfInlineInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantNotNullExtensionReceiverOfInlineInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.lexer.KtTokens @@ -106,7 +107,7 @@ class RedundantNotNullExtensionReceiverOfInlineInspection : AbstractKotlinInspec holder.registerProblem( receiverTypeReference, - "This type probably can be changed to nullable", + KotlinBundle.message("this.type.probably.can.be.changed.to.nullable"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING ) }) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantObjectTypeCheckInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantObjectTypeCheckInspection.kt index 436cff0cba1..e6440cab843 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantObjectTypeCheckInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantObjectTypeCheckInspection.kt @@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getParentOfType @@ -41,7 +42,7 @@ class RedundantObjectTypeCheckInspection : AbstractKotlinInspection() { holder.registerProblem( expression.operationReference, TextRange(0, if (expression.isNegated) 3 else 2), - "Redundant type checks for object", + KotlinBundle.message("redundant.type.checks.for.object"), ReplaceWithEqualityFix(expression.isNegated) ) } @@ -60,7 +61,7 @@ private class ReplaceWithEqualityFix(isNegated: Boolean) : LocalQuickFix { private val equality = if (isNegated) "!==" else "===" - override fun getName() = "Replace '$isOperator' with '$equality'" + override fun getName() = KotlinBundle.message("replace.with.equality.fix.text", isOperator, equality) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt index 1b0429f934e..127d1c53cee 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantRequireNotNullCallInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.inspections.collections.isCalling @@ -47,7 +48,7 @@ class RedundantRequireNotNullCallInspection : AbstractKotlinInspection() { val functionName = callee.text holder.registerProblem( callee, - "Redundant '$functionName' call", + KotlinBundle.message("redundant.0.call", functionName), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, RemoveRequireNotNullCallFix(functionName) ) @@ -63,7 +64,7 @@ class RedundantRequireNotNullCallInspection : AbstractKotlinInspection() { } private class RemoveRequireNotNullCallFix(private val functionName: String) : LocalQuickFix { - override fun getName() = "Remove '$functionName' call" + override fun getName() = KotlinBundle.message("remove.require.not.null.call.fix.text", functionName) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt index 806e01b1b49..eeaba6105c7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantReturnLabelInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.quickfix.RemoveReturnLabelFix import org.jetbrains.kotlin.psi.KtLambdaExpression import org.jetbrains.kotlin.psi.KtNamedFunction @@ -24,7 +25,7 @@ class RedundantReturnLabelInspection : AbstractKotlinInspection() { val labelName = label.getReferencedName() holder.registerProblem( label, - "Redundant '@$labelName'", + KotlinBundle.message("redundant.0", labelName), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveReturnLabelFix(returnExpression, labelName), returnExpression.containingKtFile), ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt index ec50d7a8778..4768a559818 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSamConstructorInspection.kt @@ -11,6 +11,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.codegen.SamCodegenUtil import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade import org.jetbrains.kotlin.idea.project.languageVersionSettings @@ -36,7 +37,8 @@ import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode import org.jetbrains.kotlin.resolve.sam.SamConversionOracle import org.jetbrains.kotlin.resolve.sam.SamConversionResolver import org.jetbrains.kotlin.resolve.sam.getFunctionTypeForPossibleSamType -import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.types.TypeUtils +import org.jetbrains.kotlin.types.isNullable import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.utils.keysToMapExceptNulls @@ -53,7 +55,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { val problemDescriptor = holder.manager.createProblemDescriptor( single.getQualifiedExpressionForSelector()?.receiverExpression ?: calleeExpression, single.typeArgumentList ?: calleeExpression, - "Redundant SAM-constructor", + KotlinBundle.message("redundant.sam.constructor"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly, createQuickFix(single) @@ -63,7 +65,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { } else { val problemDescriptor = holder.manager.createProblemDescriptor( expression.valueArgumentList!!, - "Redundant SAM-constructors", + KotlinBundle.message("redundant.sam.constructors"), createQuickFix(samConstructorCalls), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, isOnTheFly @@ -76,7 +78,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { private fun createQuickFix(expression: KtCallExpression): LocalQuickFix { return object : LocalQuickFix { - override fun getName() = "Remove redundant SAM-constructor" + override fun getName() = KotlinBundle.message("remove.redundant.sam.constructor") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { if (!FileModificationService.getInstance().preparePsiElementForWrite(expression)) return @@ -87,7 +89,7 @@ class RedundantSamConstructorInspection : AbstractKotlinInspection() { private fun createQuickFix(expressions: Collection): LocalQuickFix { return object : LocalQuickFix { - override fun getName() = "Remove redundant SAM-constructors" + override fun getName() = KotlinBundle.message("remove.redundant.sam.constructors") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { for (callExpression in expressions) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt index ae4dd5d3a65..89bb0f33a0b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSemicolonInspection.kt @@ -13,6 +13,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiWhiteSpace import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.util.isLineBreak import org.jetbrains.kotlin.kdoc.psi.api.KDoc import org.jetbrains.kotlin.lexer.KtModifierKeywordToken @@ -30,7 +31,7 @@ class RedundantSemicolonInspection : AbstractKotlinInspection(), CleanupLocalIns if (element.node.elementType == KtTokens.SEMICOLON && isRedundantSemicolon(element)) { holder.registerProblem( element, - "Redundant semicolon", + KotlinBundle.message("redundant.semicolon"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, Fix ) @@ -110,7 +111,7 @@ class RedundantSemicolonInspection : AbstractKotlinInspection(), CleanupLocalIns } private object Fix : LocalQuickFix { - override fun getName() = "Remove redundant semicolon" + override fun getName() = KotlinBundle.message("fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt index 050b2299118..7f9641db860 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -20,7 +21,7 @@ class RedundantSetterInspection : AbstractKotlinInspection(), CleanupLocalInspec if (accessor.isRedundantSetter()) { holder.registerProblem( accessor, - "Redundant setter", + KotlinBundle.message("redundant.setter"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, rangeInElement, RemoveRedundantSetterFix() @@ -46,7 +47,7 @@ fun KtPropertyAccessor.isRedundantSetter(): Boolean { class RemoveRedundantSetterFix : LocalQuickFix { - override fun getName() = "Remove redundant setter" + override fun getName() = KotlinBundle.message("remove.redundant.setter.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt index 0d720ddb4d9..65623868c47 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSuspendModifierInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent import org.jetbrains.kotlin.idea.highlighter.hasSuspendCalls import org.jetbrains.kotlin.idea.project.languageVersionSettings @@ -41,7 +42,7 @@ class RedundantSuspendModifierInspection : AbstractKotlinInspection() { holder.registerProblem( suspendModifier, - "Redundant 'suspend' modifier", + KotlinBundle.message("redundant.suspend.modifier"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper( RemoveModifierFix(function, KtTokens.SUSPEND_KEYWORD, isRedundant = true), diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt index a1a557ce548..b0d375e31c7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitExpressionInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.intentions.loopToCallChain.previousStatement @@ -31,7 +32,7 @@ class RedundantUnitExpressionInspection : AbstractKotlinInspection(), CleanupLoc if (expression.isRedundantUnit()) { holder.registerProblem( expression, - "Redundant 'Unit'", + KotlinBundle.message("redundant.unit"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveRedundantUnitFix() ) @@ -84,7 +85,7 @@ private fun KtReturnExpression.expectedReturnType(): KotlinType? { } private class RemoveRedundantUnitFix : LocalQuickFix { - override fun getName() = "Remove redundant 'Unit'" + override fun getName() = KotlinBundle.message("remove.redundant.unit.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt index 7c58c9b999d..260828dcb50 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantUnitReturnTypeInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeIntention import org.jetbrains.kotlin.psi.KtCodeFragment @@ -25,7 +26,7 @@ class RedundantUnitReturnTypeInspection : AbstractKotlinInspection(), CleanupLoc if (hasRedundantUnitReturnType(function)) { holder.registerProblem( typeElement, - "Redundant 'Unit' return type", + KotlinBundle.message("redundant.unit.return.type"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveExplicitTypeIntention(), function.containingKtFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt index a033a95477e..3e7206fb012 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantVisibilityModifierInspection.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.config.ExplicitApiMode import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithVisibility +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny import org.jetbrains.kotlin.idea.core.implicitVisibility import org.jetbrains.kotlin.idea.project.languageVersionSettings @@ -60,7 +61,7 @@ class RedundantVisibilityModifierInspection : AbstractKotlinInspection(), Cleanu holder.registerProblem( visibilityModifier, - "Redundant visibility modifier", + KotlinBundle.message("redundant.visibility.modifier"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper( RemoveModifierFix(declaration, redundantVisibility, isRedundant = true), diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt index 20db00355a9..05bcc6a9de2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantWithInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.moveCaret import org.jetbrains.kotlin.idea.core.replaced @@ -66,7 +67,7 @@ class RedundantWithInspection : AbstractKotlinInspection() { } holder.registerProblem( callee, - "Redundant 'with' call", + KotlinBundle.message("redundant.with.call"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, quickfix ) @@ -78,7 +79,7 @@ private fun KtValueArgument.lambdaExpression(): KtLambdaExpression? = (this as? KtLambdaArgument)?.getLambdaExpression() ?: this.getArgumentExpression() as? KtLambdaExpression private class RemoveRedundantWithFix : LocalQuickFix { - override fun getName() = "Remove redundant 'with' call" + override fun getName() = KotlinBundle.message("remove.redundant.with.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt index 83ce4801d30..b93efc783c3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReformatInspection.kt @@ -24,6 +24,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile import com.intellij.psi.PsiWhiteSpace import com.intellij.psi.codeStyle.CodeStyleManager +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.formatter.FormattingChange import org.jetbrains.kotlin.idea.formatter.FormattingChange.ReplaceWhiteSpace import org.jetbrains.kotlin.idea.formatter.FormattingChange.ShiftIndentInsideRange @@ -71,7 +72,7 @@ class ReformatInspection : LocalInspectionTool() { return elements.map { ProblemDescriptorImpl( it, it, - "File is not properly formatted", + KotlinBundle.message("file.is.not.properly.formatted"), arrayOf(ReformatQuickFix), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, false, null, isOnTheFly @@ -81,7 +82,7 @@ class ReformatInspection : LocalInspectionTool() { override fun createOptionsPanel(): JComponent? { return SingleCheckboxOptionsPanel( - "Apply only to modified files (for projects under a version control)", + KotlinBundle.message("apply.only.to.modified.files.for.projects.under.a.version.control"), this, "processChangedFilesOnly" ) @@ -98,7 +99,7 @@ class ReformatInspection : LocalInspectionTool() { } private object ReformatQuickFix : LocalQuickFix { - override fun getFamilyName(): String = "Reformat File" + override fun getFamilyName(): String = KotlinBundle.message("reformat.quick.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { CodeStyleManager.getInstance(project).reformat(descriptor.psiElement.containingFile) } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveAnnotationFix.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveAnnotationFix.kt index dc4b4c2ec53..312806a61b9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveAnnotationFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveAnnotationFix.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.quickfix.KotlinQuickFixAction import org.jetbrains.kotlin.idea.quickfix.KotlinSingleIntentionActionFactory import org.jetbrains.kotlin.psi.KtAnnotationEntry @@ -27,7 +28,7 @@ class RemoveAnnotationFix(private val text: String, annotationEntry: KtAnnotatio object JvmOverloads : KotlinSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic): RemoveAnnotationFix? { val annotationEntry = diagnostic.psiElement as? KtAnnotationEntry ?: return null - return RemoveAnnotationFix("Remove @JvmOverloads annotation", annotationEntry) + return RemoveAnnotationFix(KotlinBundle.message("remove.jvmoverloads.annotation"), annotationEntry) } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveCurlyBracesFromTemplateInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveCurlyBracesFromTemplateInspection.kt index 3b577b8f64c..a7ca85fbebe 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveCurlyBracesFromTemplateInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveCurlyBracesFromTemplateInspection.kt @@ -10,19 +10,21 @@ import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.canDropBraces import org.jetbrains.kotlin.idea.core.dropBraces import org.jetbrains.kotlin.psi.KtBlockStringTemplateEntry class RemoveCurlyBracesFromTemplateInspection(@JvmField var reportWithoutWhitespace: Boolean = false) : AbstractApplicabilityBasedInspection(KtBlockStringTemplateEntry::class.java) { - override fun inspectionText(element: KtBlockStringTemplateEntry): String = "Redundant curly braces in string template" + override fun inspectionText(element: KtBlockStringTemplateEntry): String = + KotlinBundle.message("redundant.curly.braces.in.string.template") override fun inspectionHighlightType(element: KtBlockStringTemplateEntry) = if (reportWithoutWhitespace || element.hasWhitespaceAround()) ProblemHighlightType.GENERIC_ERROR_OR_WARNING else ProblemHighlightType.INFORMATION - override val defaultFixText: String = "Remove curly braces" + override val defaultFixText: String = KotlinBundle.message("remove.curly.braces") override fun isApplicable(element: KtBlockStringTemplateEntry): Boolean = element.canDropBraces() @@ -31,7 +33,7 @@ class RemoveCurlyBracesFromTemplateInspection(@JvmField var reportWithoutWhitesp } override fun createOptionsPanel() = MultipleCheckboxOptionsPanel(this).apply { - addCheckbox("Report also for a variables without a whitespace around", "reportWithoutWhitespace") + addCheckbox(KotlinBundle.message("report.also.for.a.variables.without.a.whitespace.around"), "reportWithoutWhitespace") } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt index 4b6d4d84502..a10c19d26db 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveEmptyParenthesesFromAnnotationEntryInspection.kt @@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtAnnotationEntry import org.jetbrains.kotlin.psi.KtValueArgumentList @@ -37,7 +38,7 @@ class RemoveEmptyParenthesesFromAnnotationEntryInspection : AbstractKotlinInspec holder.registerProblem( list, - "Parentheses should be removed", + KotlinBundle.message("parentheses.should.be.removed"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveEmptyParenthesesFromAnnotationEntryFix() ) @@ -54,7 +55,7 @@ class RemoveEmptyParenthesesFromAnnotationEntryInspection : AbstractKotlinInspec private class RemoveEmptyParenthesesFromAnnotationEntryFix : LocalQuickFix { - override fun getName() = "Remove unnecessary parentheses" + override fun getName() = KotlinBundle.message("remove.empty.parentheses.from.annotation.entry.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt index 1421db62e13..42668584e23 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantBackticksInspection.kt @@ -24,6 +24,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor import com.intellij.psi.impl.source.tree.SharedImplUtil +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.unquote import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.KtElement @@ -59,7 +60,7 @@ class RemoveRedundantBackticksInspection : AbstractKotlinInspection() { private fun registerProblem(holder: ProblemsHolder, element: PsiElement) { holder.registerProblem( element, - "Remove redundant backticks", + KotlinBundle.message("remove.redundant.backticks.quick.fix.text"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, RemoveRedundantBackticksQuickFix() ) @@ -67,7 +68,7 @@ class RemoveRedundantBackticksInspection : AbstractKotlinInspection() { } class RemoveRedundantBackticksQuickFix : LocalQuickFix { - override fun getName() = "Remove redundant backticks" + override fun getName() = KotlinBundle.message("remove.redundant.backticks.quick.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt index 862332d0233..b79071364df 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantQualifierNameInspection.kt @@ -11,6 +11,7 @@ import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.analysis.analyzeAsReplacement import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.ShortenReferences @@ -145,7 +146,7 @@ private fun reportProblem(holder: ProblemsHolder, element: KtElement) { val firstChild = element.firstChild holder.registerProblem( element, - "Redundant qualifier name", + KotlinBundle.message("redundant.qualifier.name"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, TextRange.from(firstChild.startOffsetInParent, firstChild.textLength + 1), RemoveRedundantQualifierNameQuickFix() @@ -153,7 +154,7 @@ private fun reportProblem(holder: ProblemsHolder, element: KtElement) { } class RemoveRedundantQualifierNameQuickFix : LocalQuickFix { - override fun getName() = "Remove redundant qualifier name" + override fun getName() = KotlinBundle.message("remove.redundant.qualifier.name.quick.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt index 7d9eea716c6..c52a21f953c 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveRedundantSpreadOperatorInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.isArrayOfMethod import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.endOffset @@ -39,7 +40,7 @@ class RemoveRedundantSpreadOperatorInspection : AbstractKotlinInspection() { val problemDescriptor = holder.manager.createProblemDescriptor( argument, TextRange(startOffset, endOffset), - "Remove redundant spread operator", + KotlinBundle.message("remove.redundant.spread.operator.quickfix.text"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, isOnTheFly, RemoveRedundantSpreadOperatorQuickfix() @@ -50,7 +51,7 @@ class RemoveRedundantSpreadOperatorInspection : AbstractKotlinInspection() { } class RemoveRedundantSpreadOperatorQuickfix : LocalQuickFix { - override fun getName() = "Remove redundant spread operator" + override fun getName() = KotlinBundle.message("remove.redundant.spread.operator.quickfix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt index 9ad6ded5a5d..2f971c89f12 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveSetterParameterTypeInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeIntention import org.jetbrains.kotlin.idea.intentions.isSetterParameter import org.jetbrains.kotlin.psi.parameterVisitor @@ -23,7 +24,7 @@ class RemoveSetterParameterTypeInspection : AbstractKotlinInspection() { ?.takeIf { it.endOffset > it.startOffset } ?: return@parameterVisitor holder.registerProblem( typeReference, - "Redundant setter parameter type", + KotlinBundle.message("redundant.setter.parameter.type"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveExplicitTypeIntention(), parameter.containingKtFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt index bc849af54fa..38b82266411 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RemoveToStringInStringTemplateInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInsight.FileModificationService import com.intellij.codeInspection.* import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.isToString import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.canPlaceAfterSimpleNameEntry @@ -22,7 +23,7 @@ class RemoveToStringInStringTemplateInspection : AbstractKotlinInspection(), Cle holder.registerProblem( selectorExpression, - "Redundant 'toString()' call in string template", + KotlinBundle.message("redundant.tostring.call.in.string.template"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, RemoveToStringFix() ) @@ -30,7 +31,7 @@ class RemoveToStringInStringTemplateInspection : AbstractKotlinInspection(), Cle } class RemoveToStringFix : LocalQuickFix { - override fun getName() = "Remove 'toString()' call" + override fun getName() = KotlinBundle.message("remove.to.string.fix.text") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayEqualityOpWithArraysEqualsInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayEqualityOpWithArraysEqualsInspection.kt index 2d6a6e2d24f..ac4f061b679 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayEqualityOpWithArraysEqualsInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayEqualityOpWithArraysEqualsInspection.kt @@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.resolvedToArrayType import org.jetbrains.kotlin.lexer.KtTokens @@ -55,14 +56,14 @@ class ReplaceArrayEqualityOpWithArraysEqualsInspection : AbstractApplicabilityBa return rightResolvedCall?.resolvedToArrayType() == true && leftResolvedCall?.resolvedToArrayType() == true } - override fun inspectionText(element: KtBinaryExpression) = "Dangerous array comparison" + override fun inspectionText(element: KtBinaryExpression) = KotlinBundle.message("dangerous.array.comparison") override val defaultFixText: String - get() = "Replace with 'contentEquals'" + get() = KotlinBundle.message("replace.with.contentequals3") override fun fixText(element: KtBinaryExpression): String = when (element.operationToken) { - KtTokens.EQEQ -> "Replace '==' with 'contentEquals'" - KtTokens.EXCLEQ -> "Replace '!=' with 'contentEquals'" + KtTokens.EQEQ -> KotlinBundle.message("replace.with.contentequals2") + KtTokens.EXCLEQ -> KotlinBundle.message("replace.with.contentequals") else -> "" } } diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayOfWithLiteralInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayOfWithLiteralInspection.kt index caeb0afe5ef..7756cb5333d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayOfWithLiteralInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceArrayOfWithLiteralInspection.kt @@ -13,6 +13,7 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.config.LanguageFeature.ArrayLiteralsInAnnotations +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.isArrayOfMethod import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.psi.* @@ -44,14 +45,14 @@ class ReplaceArrayOfWithLiteralInspection : AbstractKotlinInspection() { val calleeName = calleeExpression.getReferencedName() holder.registerProblem( calleeExpression, - "'$calleeName' call should be replaced with array literal [...]", + KotlinBundle.message("0.call.should.be.replaced.with.array.literal", calleeName), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithArrayLiteralFix() ) }) private class ReplaceWithArrayLiteralFix : LocalQuickFix { - override fun getFamilyName() = "Replace with [...]" + override fun getFamilyName() = KotlinBundle.message("replace.with.array.literal.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val calleeExpression = descriptor.psiElement as KtExpression diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssertBooleanWithAssertEqualityInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssertBooleanWithAssertEqualityInspection.kt index a30b7c427e4..fa27dac6a80 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssertBooleanWithAssertEqualityInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssertBooleanWithAssertEqualityInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInsight.actions.OptimizeImportsProcessor import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.ShortenReferences import org.jetbrains.kotlin.idea.core.replaced @@ -25,13 +26,13 @@ import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf class ReplaceAssertBooleanWithAssertEqualityInspection : AbstractApplicabilityBasedInspection( KtCallExpression::class.java ) { - override fun inspectionText(element: KtCallExpression) = "Replace assert boolean with assert equality" + override fun inspectionText(element: KtCallExpression) = KotlinBundle.message("replace.assert.boolean.with.assert.equality") - override val defaultFixText = "Replace assert boolean with assert equality" + override val defaultFixText = KotlinBundle.message("replace.assert.boolean.with.assert.equality") override fun fixText(element: KtCallExpression): String { val assertion = element.replaceableAssertion() ?: return defaultFixText - return "Replace with '$assertion'" + return KotlinBundle.message("replace.with.0", assertion) } override fun isApplicable(element: KtCallExpression): Boolean { diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssociateFunctionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssociateFunctionInspection.kt index ad5a15e2f33..5b94bf9f3b1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssociateFunctionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceAssociateFunctionInspection.kt @@ -14,6 +14,7 @@ import com.intellij.openapi.project.Project import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.getLastLambdaExpression import org.jetbrains.kotlin.idea.inspections.AssociateFunction.* @@ -70,7 +71,7 @@ class ReplaceAssociateFunctionInspection : AbstractKotlinInspection() { } holder.registerProblemWithoutOfflineInformation( calleeExpression, - "Replace '${calleeExpression.text}' with '${associateFunction.name(isAssociateTo)}'", + KotlinBundle.message("replace.0.with.1", calleeExpression.text, associateFunction.name(isAssociateTo)), isOnTheFly, highlightType, ReplaceAssociateFunctionFix(associateFunction, isAssociateTo) @@ -85,7 +86,7 @@ class ReplaceAssociateFunctionInspection : AbstractKotlinInspection() { private class ReplaceAssociateFunctionFix(private val function: AssociateFunction, private val hasDestination: Boolean) : LocalQuickFix { private val functionName = function.name(hasDestination) - override fun getName() = "Replace with '$functionName'" + override fun getName() = KotlinBundle.message("replace.with.0", functionName) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceCollectionCountWithSizeInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceCollectionCountWithSizeInspection.kt index 503324b0062..94b35e29b67 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceCollectionCountWithSizeInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceCollectionCountWithSizeInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.inspections.collections.isCalling import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.psi.KtCallExpression @@ -22,7 +23,7 @@ class ReplaceCollectionCountWithSizeInspection : AbstractKotlinInspection() { if (callExpression.isCount()) { holder.registerProblem( callExpression, - "Could be replaced with `size`", + KotlinBundle.message("could.be.replaced.with.size"), ReplaceCollectionCountWithSizeQuickFix() ) } @@ -31,7 +32,7 @@ class ReplaceCollectionCountWithSizeInspection : AbstractKotlinInspection() { } class ReplaceCollectionCountWithSizeQuickFix : LocalQuickFix { - override fun getName() = "Replace 'count' with 'size'" + override fun getName() = KotlinBundle.message("replace.collection.count.with.size.quick.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceGuardClauseWithFunctionCallInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceGuardClauseWithFunctionCallInspection.kt index 24bac07597d..11a6d223979 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceGuardClauseWithFunctionCallInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceGuardClauseWithFunctionCallInspection.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.ShortenReferences import org.jetbrains.kotlin.idea.core.replaced @@ -42,12 +43,12 @@ class ReplaceGuardClauseWithFunctionCallInspection : AbstractApplicabilityBasedI get() = "kotlin.$functionName" } - override fun inspectionText(element: KtIfExpression) = "Replace guard clause with kotlin's function call" + override fun inspectionText(element: KtIfExpression) = KotlinBundle.message("replace.guard.clause.with.kotlin.s.function.call") - override val defaultFixText = "Replace with kotlin's function call" + override val defaultFixText = KotlinBundle.message("replace.with.kotlin.s.function.call") override fun fixText(element: KtIfExpression) = - element.getKotlinFunction()?.let { "Replace with '${it.functionName}()' call" } ?: defaultFixText + element.getKotlinFunction()?.let { KotlinBundle.message("replace.with.0.call", it.functionName) } ?: defaultFixText override fun inspectionHighlightRangeInElement(element: KtIfExpression) = element.ifKeyword.textRangeIn(element) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceManualRangeWithIndicesCallsInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceManualRangeWithIndicesCallsInspection.kt index 1d4ce373162..d7a6ae8a183 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceManualRangeWithIndicesCallsInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceManualRangeWithIndicesCallsInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.search.searches.ReferencesSearch +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.getArguments import org.jetbrains.kotlin.idea.intentions.isSizeOrLength import org.jetbrains.kotlin.lexer.KtTokens @@ -60,7 +61,7 @@ class ReplaceManualRangeWithIndicesCallsInspection : AbstractKotlinInspection() ) { holder.registerProblem( range, - "For loop over indices could be replaced with loop over elements", + KotlinBundle.message("for.loop.over.indices.could.be.replaced.with.loop.over.elements"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceIndexLoopWithCollectionLoopQuickFix() ) @@ -70,7 +71,7 @@ class ReplaceManualRangeWithIndicesCallsInspection : AbstractKotlinInspection() } holder.registerProblem( range, - "Range could be replaced with '.indices' call", + KotlinBundle.message("range.could.be.replaced.with.indices.call"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceManualRangeWithIndicesCallQuickFix() ) @@ -78,7 +79,7 @@ class ReplaceManualRangeWithIndicesCallsInspection : AbstractKotlinInspection() } class ReplaceManualRangeWithIndicesCallQuickFix : LocalQuickFix { - override fun getName() = "Replace with indices" + override fun getName() = KotlinBundle.message("replace.manual.range.with.indices.call.quick.fix.text") override fun getFamilyName() = name @@ -99,7 +100,7 @@ class ReplaceManualRangeWithIndicesCallQuickFix : LocalQuickFix { } class ReplaceIndexLoopWithCollectionLoopQuickFix : LocalQuickFix { - override fun getName() = "Replace with loop over elements" + override fun getName() = KotlinBundle.message("replace.index.loop.with.collection.loop.quick.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNegatedIsEmptyWithIsNotEmptyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNegatedIsEmptyWithIsNotEmptyInspection.kt index dba55ac1dba..ce0c834aaa4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNegatedIsEmptyWithIsNotEmptyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNegatedIsEmptyWithIsNotEmptyInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.inspections.collections.isCalling import org.jetbrains.kotlin.idea.intentions.callExpression @@ -30,7 +31,7 @@ class ReplaceNegatedIsEmptyWithIsNotEmptyInspection : AbstractKotlinInspection() val to = expression.invertSelectorFunction()?.callExpression?.calleeExpression?.text ?: return holder.registerProblem( calleeExpression, - "Replace negated '$from' with '$to'", + KotlinBundle.message("replace.negated.0.with.1", from, to), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceNegatedIsEmptyWithIsNotEmptyQuickFix(from, to) ) @@ -58,7 +59,7 @@ class ReplaceNegatedIsEmptyWithIsNotEmptyInspection : AbstractKotlinInspection() } class ReplaceNegatedIsEmptyWithIsNotEmptyQuickFix(private val from: String, private val to: String) : LocalQuickFix { - override fun getName() = "Replace negated '$from' with '$to'" + override fun getName() = KotlinBundle.message("replace.negated.0.with.1", from, to) override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNotNullAssertionWithElvisReturnInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNotNullAssertionWithElvisReturnInspection.kt index c23c5d509f0..d59dfa177ed 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNotNullAssertionWithElvisReturnInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceNotNullAssertionWithElvisReturnInspection.kt @@ -13,6 +13,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.replaced import org.jetbrains.kotlin.idea.intentions.getParentLambdaLabelName @@ -57,7 +58,7 @@ class ReplaceNotNullAssertionWithElvisReturnInspection : AbstractKotlinInspectio holder.registerProblem( postfix.operationReference, - "Replace '!!' with '?: return'", + KotlinBundle.message("replace.with.return"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithElvisReturnFix(isNullable, returnLabelName) ) @@ -71,7 +72,7 @@ class ReplaceNotNullAssertionWithElvisReturnInspection : AbstractKotlinInspectio private val returnNull: Boolean, private val returnLabelName: String? ) : LocalQuickFix, LowPriorityAction { - override fun getName() = "Replace with '?: return${if (returnNull) " null" else ""}'" + override fun getName() = KotlinBundle.message("replace.with.elvis.return.fix.text", if (returnNull) " null" else "") override fun getFamilyName() = name override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val postfix = descriptor.psiElement.parent as? KtPostfixExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplacePutWithAssignmentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplacePutWithAssignmentInspection.kt index c72f32c1896..cd08273f6ea 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplacePutWithAssignmentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplacePutWithAssignmentInspection.kt @@ -20,6 +20,7 @@ import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.kotlin.builtins.DefaultBuiltIns import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.callExpression import org.jetbrains.kotlin.idea.util.calleeTextRangeInThis @@ -82,9 +83,10 @@ class ReplacePutWithAssignmentInspection : AbstractApplicabilityBasedInspection< override fun inspectionHighlightRangeInElement(element: KtDotQualifiedExpression) = element.calleeTextRangeInThis() - override fun inspectionText(element: KtDotQualifiedExpression): String = "map.put() should be converted to assignment" + override fun inspectionText(element: KtDotQualifiedExpression): String = + KotlinBundle.message("map.put.should.be.converted.to.assignment") - override val defaultFixText = "Convert put to assignment" + override val defaultFixText = KotlinBundle.message("convert.put.to.assignment") companion object { private val compatibleNames = setOf("put") diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeStartEndInclusiveWithFirstLastInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeStartEndInclusiveWithFirstLastInspection.kt index 75568b75d02..6f064fa5611 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeStartEndInclusiveWithFirstLastInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeStartEndInclusiveWithFirstLastInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.psi.KtDotQualifiedExpression import org.jetbrains.kotlin.psi.KtPsiFactory @@ -30,13 +31,13 @@ class ReplaceRangeStartEndInclusiveWithFirstLastInspection : AbstractKotlinInspe if (selectorExpression.text == "start") { holder.registerProblem( expression, - "Could be replaced with unboxed `first`", + KotlinBundle.message("could.be.replaced.with.unboxed.first"), ReplaceIntRangeStartWithFirstQuickFix() ) } else if (selectorExpression.text == "endInclusive") { holder.registerProblem( expression, - "Could be replaced with unboxed `last`", + KotlinBundle.message("could.be.replaced.with.unboxed.last"), ReplaceIntRangeEndInclusiveWithLastQuickFix() ) } @@ -57,7 +58,7 @@ private fun ClassDescriptor.isRange(): Boolean { } class ReplaceIntRangeStartWithFirstQuickFix : LocalQuickFix { - override fun getName() = "Replace 'start' with 'first'" + override fun getName() = KotlinBundle.message("replace.int.range.start.with.first.quick.fix.text") override fun getFamilyName() = name @@ -69,7 +70,7 @@ class ReplaceIntRangeStartWithFirstQuickFix : LocalQuickFix { } class ReplaceIntRangeEndInclusiveWithLastQuickFix : LocalQuickFix { - override fun getName() = "Replace 'endInclusive' with 'last'" + override fun getName() = KotlinBundle.message("replace.int.range.end.inclusive.with.last.quick.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt index 60e3a1ca008..b369246a0a9 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceRangeToWithUntilInspection.kt @@ -21,6 +21,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.getArguments import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -30,14 +31,14 @@ class ReplaceRangeToWithUntilInspection : AbstractPrimitiveRangeToInspection() { if (!isApplicable(expression)) return holder.registerProblem( expression, - "'rangeTo' or the '..' call should be replaced with 'until'", + KotlinBundle.message("rangeto.or.the.call.should.be.replaced.with.until"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithUntilQuickFix() ) } class ReplaceWithUntilQuickFix : LocalQuickFix { - override fun getName() = "Replace with until" + override fun getName() = KotlinBundle.message("replace.with.until.quick.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringFormatWithLiteralInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringFormatWithLiteralInspection.kt index 39a01a94439..6681b2383e4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringFormatWithLiteralInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringFormatWithLiteralInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.imports.importableFqName import org.jetbrains.kotlin.idea.intentions.ConvertToStringTemplateIntention @@ -53,7 +54,7 @@ class ReplaceStringFormatWithLiteralInspection : AbstractKotlinInspection() { holder.registerProblem( qualifiedExpression ?: callExpression, - "String.format call can be replaced with string templates", + KotlinBundle.message("string.format.call.can.be.replaced.with.string.templates"), ProblemHighlightType.INFORMATION, ReplaceWithStringLiteralFix() ) @@ -66,7 +67,7 @@ class ReplaceStringFormatWithLiteralInspection : AbstractKotlinInspection() { } private class ReplaceWithStringLiteralFix : LocalQuickFix { - override fun getFamilyName() = "Replace with string templates" + override fun getFamilyName() = KotlinBundle.message("replace.with.string.literal.fix.family.name") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val element = descriptor.psiElement diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringInDocumentFix.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringInDocumentFix.kt index db06fe6689d..693eb45d768 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringInDocumentFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceStringInDocumentFix.kt @@ -22,6 +22,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project import com.intellij.psi.PsiElement import com.intellij.psi.SmartPointerManager +import org.jetbrains.kotlin.idea.KotlinBundle class ReplaceStringInDocumentFix(element: PsiElement, private val oldString: String, private val newString: String) : LocalQuickFix { private val elementRef = SmartPointerManager.getInstance(element.project).createSmartPsiElementPointer(element) @@ -44,5 +45,5 @@ class ReplaceStringInDocumentFix(element: PsiElement, private val oldString: Str document.replaceString(start, end, newString) } - override fun getFamilyName() = "Replace '$oldString' with '$newString'" + override fun getFamilyName() = KotlinBundle.message("replace.0.with.1", oldString, newString) } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToStringWithStringTemplateInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToStringWithStringTemplateInspection.kt index 0d13b241487..1961c08fd2e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToStringWithStringTemplateInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToStringWithStringTemplateInspection.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.core.canDropBraces import org.jetbrains.kotlin.idea.core.dropBraces import org.jetbrains.kotlin.idea.intentions.isToString @@ -28,7 +29,9 @@ class ReplaceToStringWithStringTemplateInspection : AbstractApplicabilityBasedIn if (blockStringTemplateEntry?.canDropBraces() == true) blockStringTemplateEntry.dropBraces() } - override fun inspectionText(element: KtDotQualifiedExpression) = "Call of 'toString' could be replaced with string template" + override fun inspectionText(element: KtDotQualifiedExpression) = KotlinBundle.message( + "call.of.tostring.could.be.replaced.with.string.template" + ) - override val defaultFixText = "Replace 'toString' with string template" + override val defaultFixText = KotlinBundle.message("replace.tostring.with.string.template") } \ No newline at end of file diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToWithInfixFormInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToWithInfixFormInspection.kt index 49e9787c79a..681ab9dda74 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToWithInfixFormInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceToWithInfixFormInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.intentions.callExpression import org.jetbrains.kotlin.idea.intentions.calleeName @@ -35,7 +36,7 @@ class ReplaceToWithInfixFormInspection : AbstractKotlinInspection() { holder.registerProblem( expression, - "Replace 'to' with infix form", + KotlinBundle.message("replace.to.with.infix.form.quickfix.text"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceToWithInfixFormQuickfix() ) @@ -44,7 +45,7 @@ class ReplaceToWithInfixFormInspection : AbstractKotlinInspection() { } class ReplaceToWithInfixFormQuickfix : LocalQuickFix { - override fun getName() = "Replace 'to' with infix form" + override fun getName() = KotlinBundle.message("replace.to.with.infix.form.quickfix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithEnumMapInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithEnumMapInspection.kt index 972a279ef73..60370b562a3 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithEnumMapInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithEnumMapInspection.kt @@ -10,6 +10,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveImportReference import org.jetbrains.kotlin.idea.project.platform @@ -44,7 +45,7 @@ class ReplaceWithEnumMapInspection : AbstractKotlinInspection() { val firstArgType = expectedType.arguments.firstOrNull()?.type ?: return if (!firstArgType.isEnum()) return val enumClassName = firstArgType.constructor.declarationDescriptor?.fqNameUnsafe?.asString() ?: return - holder.registerProblem(element, "Replaceable with EnumMap", ReplaceWithEnumMapFix(enumClassName)) + holder.registerProblem(element, KotlinBundle.message("replaceable.with.enummap"), ReplaceWithEnumMapFix(enumClassName)) }) } @@ -53,7 +54,7 @@ class ReplaceWithEnumMapInspection : AbstractKotlinInspection() { ) : LocalQuickFix { override fun getFamilyName() = name - override fun getName() = "Replace with EnumMap" + override fun getName() = KotlinBundle.message("replace.with.enum.map.fix.text") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val call = descriptor.psiElement as? KtCallExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithOperatorAssignmentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithOperatorAssignmentInspection.kt index 23e160d6409..d32cc6aaad4 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithOperatorAssignmentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ReplaceWithOperatorAssignmentInspection.kt @@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.tree.IElementType import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.analysis.analyzeAsReplacement import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.project.builtIns @@ -55,12 +56,15 @@ class ReplaceWithOperatorAssignmentInspection : AbstractApplicabilityBasedInspec return newBindingContext.diagnostics.forElement(opAssign.operationReference).isEmpty() } - override fun inspectionText(element: KtBinaryExpression) = "Replaceable with operator-assignment" + override fun inspectionText(element: KtBinaryExpression) = KotlinBundle.message("replaceable.with.operator.assignment") - override val defaultFixText = "Replace with operator-assignment" + override val defaultFixText = KotlinBundle.message("replace.with.operator.assignment") override fun fixText(element: KtBinaryExpression) = - "Replace with '${(element.right as? KtBinaryExpression)?.operationReference?.operationSignTokenType?.value}='" + KotlinBundle.message( + "replace.with.0", + (element.right as? KtBinaryExpression)?.operationReference?.operationSignTokenType?.value.toString() + '=' + ) override fun inspectionHighlightType(element: KtBinaryExpression): ProblemHighlightType { val left = element.left as? KtNameReferenceExpression diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SafeCastWithReturnInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SafeCastWithReturnInspection.kt index 4903940f98e..2f519ce196f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SafeCastWithReturnInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SafeCastWithReturnInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType @@ -41,7 +42,7 @@ class SafeCastWithReturnInspection : AbstractKotlinInspection() { holder.registerProblem( parent, - "Should be replaced with 'if' type check", + KotlinBundle.message("should.be.replaced.with.if.type.check"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, ReplaceWithIfFix() ) @@ -49,7 +50,7 @@ class SafeCastWithReturnInspection : AbstractKotlinInspection() { } private class ReplaceWithIfFix : LocalQuickFix { - override fun getName() = "Replace with 'if' type check" + override fun getName() = KotlinBundle.message("replace.with.if.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/ScopeFunctionConversionInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/ScopeFunctionConversionInspection.kt index 28a6b061561..30630e24d59 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/ScopeFunctionConversionInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/ScopeFunctionConversionInspection.kt @@ -15,6 +15,7 @@ import com.intellij.psi.PsiElementVisitor import com.intellij.psi.SmartPsiElementPointer import org.jetbrains.kotlin.descriptors.SimpleFunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.KotlinNameSuggester import org.jetbrains.kotlin.idea.core.ShortenReferences @@ -55,7 +56,7 @@ class ScopeFunctionConversionInspection : AbstractKotlinInspection() { if (counterpartName != null) { holder.registerProblem( expression.calleeExpression!!, - "Call is replaceable with another scope function", + KotlinBundle.message("call.is.replaceable.with.another.scope.function"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, if (counterpartName == "also" || counterpartName == "let") ConvertScopeFunctionToParameter(counterpartName) @@ -139,7 +140,7 @@ class ReplacementCollection(private val project: Project) { } abstract class ConvertScopeFunctionFix(private val counterpartName: String) : LocalQuickFix { - override fun getFamilyName() = "Convert to '$counterpartName'" + override fun getFamilyName() = KotlinBundle.message("convert.scope.function.fix.family.name", counterpartName) override fun applyFix(project: Project, problemDescriptor: ProblemDescriptor) { val callee = problemDescriptor.psiElement as KtNameReferenceExpression diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SelfAssignmentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SelfAssignmentInspection.kt index bf8c6a891c2..c5051786517 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SelfAssignmentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SelfAssignmentInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -52,7 +53,7 @@ class SelfAssignmentInspection : AbstractKotlinInspection(), CleanupLocalInspect holder.registerProblem( right, - "Variable '${rightCallee.name}' is assigned to itself", + KotlinBundle.message("variable.0.is.assigned.to.itself", rightCallee.name), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, RemoveSelfAssignmentFix() ) @@ -82,7 +83,7 @@ class SelfAssignmentInspection : AbstractKotlinInspection(), CleanupLocalInspect } private class RemoveSelfAssignmentFix : LocalQuickFix { - override fun getName() = "Remove self assignment" + override fun getName() = KotlinBundle.message("remove.self.assignment.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SelfReferenceConstructorParameterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SelfReferenceConstructorParameterInspection.kt index df8ef495692..ca20cdd9a1b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SelfReferenceConstructorParameterInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SelfReferenceConstructorParameterInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.LocalQuickFix import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.setType import org.jetbrains.kotlin.psi.KtParameter @@ -28,7 +29,7 @@ class SelfReferenceConstructorParameterInspection : AbstractKotlinInspection() { holder.registerProblem( parameter, rangeInElement, - "Constructor has non-null self reference parameter", + KotlinBundle.message("constructor.has.non.null.self.reference.parameter"), ConvertToNullableTypeFix() ) }) @@ -49,7 +50,7 @@ class SelfReferenceConstructorParameterInspection : AbstractKotlinInspection() { } private class ConvertToNullableTypeFix : LocalQuickFix { - override fun getName() = "Convert to nullable type" + override fun getName() = KotlinBundle.message("convert.to.nullable.type.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SetterBackingFieldAssignmentInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SetterBackingFieldAssignmentInspection.kt index 6d2d68ffdda..052455990de 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SetterBackingFieldAssignmentInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SetterBackingFieldAssignmentInspection.kt @@ -11,6 +11,7 @@ import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiWhiteSpace import org.jetbrains.kotlin.descriptors.PropertyDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.lexer.KtTokens import org.jetbrains.kotlin.psi.* @@ -54,7 +55,7 @@ class SetterBackingFieldAssignmentInspection : AbstractKotlinInspection(), Clean holder.registerProblem( accessor, - "Existing backing field is not assigned by the setter", + KotlinBundle.message("existing.backing.field.is.not.assigned.by.the.setter"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, AssignBackingFieldFix() ) @@ -71,7 +72,7 @@ private val assignmentOperators = listOf(KtTokens.EQ, KtTokens.PLUSEQ, KtTokens. private val incrementAndDecrementOperators = listOf(KtTokens.PLUSPLUS, KtTokens.MINUSMINUS) private class AssignBackingFieldFix : LocalQuickFix { - override fun getName() = "Assign backing field" + override fun getName() = KotlinBundle.message("assign.backing.field.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/SimplifyAssertNotNullInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/SimplifyAssertNotNullInspection.kt index dd3b7faa356..31051909c86 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/SimplifyAssertNotNullInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/SimplifyAssertNotNullInspection.kt @@ -20,6 +20,7 @@ import com.intellij.codeInsight.CodeInsightUtilCore import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall import org.jetbrains.kotlin.idea.core.ShortenReferences import org.jetbrains.kotlin.idea.core.moveCaret @@ -61,15 +62,15 @@ class SimplifyAssertNotNullInspection : AbstractApplicabilityBasedInspection - "Variable used only in following return and should be inlined" - Status.EXACT_COPY -> - "Variable is same as '${(element.initializer as? KtNameReferenceExpression)?.getReferencedName()}' and should be inlined" + Status.RETURN_ONLY -> KotlinBundle.message("variable.used.only.in.following.return.and.should.be.inlined") + Status.EXACT_COPY -> KotlinBundle.message( + "variable.is.same.as.0.and.should.be.inlined", + (element.initializer as? KtNameReferenceExpression)?.getReferencedName().toString() + ) else -> "" } - override val defaultFixText = "Inline variable" + override val defaultFixText = KotlinBundle.message("inline.variable") override val startFixInWriteAction = false diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnsafeCastFromDynamicInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnsafeCastFromDynamicInspection.kt index e1168a9a02e..6afb3d0407a 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnsafeCastFromDynamicInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnsafeCastFromDynamicInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.* import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtPsiFactory @@ -30,7 +31,7 @@ class UnsafeCastFromDynamicInspection : AbstractKotlinInspection() { if (actualType.isDynamic() && !expectedType.isDynamic() && !TypeUtils.noExpectedType(expectedType)) { holder.registerProblem( expression, - "Implicit (unsafe) cast from dynamic to $expectedType", + KotlinBundle.message("implicit.unsafe.cast.from.dynamic.to.0", expectedType), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, CastExplicitlyFix(expectedType) ) @@ -39,7 +40,7 @@ class UnsafeCastFromDynamicInspection : AbstractKotlinInspection() { } private class CastExplicitlyFix(private val type: KotlinType) : LocalQuickFix { - override fun getName() = "Cast explicitly" + override fun getName() = KotlinBundle.message("cast.explicitly.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedEqualsInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedEqualsInspection.kt index d56f7291cd8..01651c10539 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedEqualsInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedEqualsInspection.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.inspections import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.intentions.conventionNameCalls.isAnyEquals import org.jetbrains.kotlin.lexer.KtTokens @@ -25,7 +26,7 @@ class UnusedEqualsInspection : AbstractKotlinInspection() { if (!expression.isUsedAsExpression(context)) { holder.registerProblem( target, - "Unused equals expression", + KotlinBundle.message("unused.equals.expression"), ProblemHighlightType.LIKE_UNUSED_SYMBOL ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedLambdaExpressionBodyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedLambdaExpressionBodyInspection.kt index 19330804e9e..e5b17a16a5d 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedLambdaExpressionBodyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedLambdaExpressionBodyInspection.kt @@ -14,6 +14,7 @@ import com.intellij.psi.PsiElementVisitor import com.intellij.psi.PsiFile import org.jetbrains.kotlin.builtins.isFunctionType import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtFunction import org.jetbrains.kotlin.psi.KtLambdaExpression @@ -49,7 +50,7 @@ class UnusedLambdaExpressionBodyInspection : AbstractKotlinInspection() { holder.registerProblem( expression, - "Unused return value of a function with lambda expression body", + KotlinBundle.message("unused.return.value.of.a.function.with.lambda.expression.body"), RemoveEqTokenFromFunctionDeclarationFix(function) ) }) @@ -58,7 +59,7 @@ class UnusedLambdaExpressionBodyInspection : AbstractKotlinInspection() { private fun CallableDescriptor.returnsFunction() = returnType?.isFunctionType ?: false class RemoveEqTokenFromFunctionDeclarationFix(function: KtFunction) : LocalQuickFixOnPsiElement(function) { - override fun getText(): String = "Remove '=' token from function declaration" + override fun getText(): String = KotlinBundle.message("remove.token.from.function.declaration") override fun getFamilyName(): String = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt index 4c3e420c700..d8f90150993 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedMainParameterInspection.kt @@ -9,6 +9,7 @@ import com.intellij.codeInspection.IntentionWrapper import com.intellij.codeInspection.LocalInspectionToolSession import com.intellij.codeInspection.ProblemHighlightType import com.intellij.codeInspection.ProblemsHolder +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithContent import org.jetbrains.kotlin.idea.quickfix.RemoveUnusedFunctionParameterFix import org.jetbrains.kotlin.psi.KtNamedFunction @@ -26,7 +27,7 @@ class UnusedMainParameterInspection : AbstractKotlinInspection() { if (context[UNUSED_MAIN_PARAMETER, parameter] == true) { holder.registerProblem( parameter, - "Since Kotlin 1.3 main parameter is not necessary", + KotlinBundle.message("since.kotlin.1.3.main.parameter.is.not.necessary"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, IntentionWrapper(RemoveUnusedFunctionParameterFix(parameter), parameter.containingFile) ) diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt index c634785dbfb..d5b99760b10 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedSymbolInspection.kt @@ -40,6 +40,7 @@ import org.jetbrains.kotlin.asJava.toLightClass import org.jetbrains.kotlin.asJava.toLightMethods import org.jetbrains.kotlin.config.AnalysisFlags import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.project.implementingDescriptors import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.findModuleDescriptor @@ -554,12 +555,12 @@ class UnusedSymbolInspection : AbstractKotlinInspection() { class SafeDeleteFix(declaration: KtDeclaration) : LocalQuickFix { private val name: String = - if (declaration is KtConstructor<*>) "Safe delete constructor" + if (declaration is KtConstructor<*>) KotlinBundle.message("safe.delete.constructor") else QuickFixBundle.message("safe.delete.text", declaration.name) override fun getName() = name - override fun getFamilyName() = "Safe delete" + override fun getFamilyName() = QuickFixBundle.message("safe.delete.family") override fun startInWriteAction(): Boolean = false diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedUnaryOperatorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedUnaryOperatorInspection.kt index 6a96488478f..2b5dcedc8d0 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedUnaryOperatorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UnusedUnaryOperatorInspection.kt @@ -12,6 +12,7 @@ import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.DeclarationDescriptor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.util.textRangeIn import org.jetbrains.kotlin.lexer.KtTokens @@ -34,7 +35,7 @@ class UnusedUnaryOperatorInspection : AbstractKotlinInspection() { holder.registerProblem( prefix, - "Unused unary operator", + KotlinBundle.message("unused.unary.operator"), ProblemHighlightType.LIKE_UNUSED_SYMBOL, prefix.operationReference.textRangeIn(prefix), RemoveUnaryOperatorFix() @@ -42,7 +43,7 @@ class UnusedUnaryOperatorInspection : AbstractKotlinInspection() { }) private class RemoveUnaryOperatorFix : LocalQuickFix { - override fun getName() = "Remove unused unary operator" + override fun getName() = KotlinBundle.message("remove.unary.operator.fix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt index b825aec7040..b71b8f559d5 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/UseExpressionBodyInspection.kt @@ -16,6 +16,7 @@ import com.intellij.openapi.project.Project import com.intellij.profile.codeInspection.ProjectInspectionProfileManager import com.intellij.psi.PsiElement import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.core.canOmitDeclaredType import org.jetbrains.kotlin.idea.core.replaced @@ -51,10 +52,10 @@ class UseExpressionBodyInspection(private val convertEmptyToUnit: Boolean) : Abs val toHighlight = valueStatement.toHighlight() return when { - valueStatement !is KtReturnExpression -> Status(toHighlight, "block body", INFORMATION) - valueStatement.returnedExpression is KtWhenExpression -> Status(toHighlight, "'return when'", INFORMATION) - valueStatement.isOneLiner() -> Status(toHighlight, "one-line return", GENERIC_ERROR_OR_WARNING) - else -> Status(toHighlight, "return", INFORMATION) + valueStatement !is KtReturnExpression -> Status(toHighlight, KotlinBundle.message("block.body"), INFORMATION) + valueStatement.returnedExpression is KtWhenExpression -> Status(toHighlight, KotlinBundle.message("return.when"), INFORMATION) + valueStatement.isOneLiner() -> Status(toHighlight, KotlinBundle.message("one.line.return"), GENERIC_ERROR_OR_WARNING) + else -> Status(toHighlight, KotlinBundle.message("text.return"), INFORMATION) } } @@ -85,7 +86,7 @@ class UseExpressionBodyInspection(private val convertEmptyToUnit: Boolean) : Abs holder.registerProblemWithoutOfflineInformation( declaration, - "Use expression body instead of $suffix", + KotlinBundle.message("use.expression.body.instead.of.0", suffix), isOnTheFly, highlightType, toHighlightRange?.shiftRight(-declaration.startOffset), @@ -202,7 +203,7 @@ class UseExpressionBodyInspection(private val convertEmptyToUnit: Boolean) : Abs inner class ConvertToExpressionBodyFix : LocalQuickFix { override fun getFamilyName() = name - override fun getName() = "Convert to expression body" + override fun getName() = KotlinBundle.message("convert.to.expression.body.fix.text") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val declaration = descriptor.psiElement as? KtDeclarationWithBody ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/WhenWithOnlyElseInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/WhenWithOnlyElseInspection.kt index a690dd62e80..6517d401191 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/WhenWithOnlyElseInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/WhenWithOnlyElseInspection.kt @@ -11,6 +11,7 @@ import com.intellij.codeInspection.ProblemDescriptor import com.intellij.codeInspection.ProblemsHolder import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.psi.psiUtil.startOffset @@ -28,7 +29,7 @@ class WhenWithOnlyElseInspection : AbstractKotlinInspection() { holder.registerProblem( expression, expression.whenKeyword.textRange.shiftLeft(expression.startOffset), - "'when' has only 'else' branch and should be simplified", + KotlinBundle.message("when.has.only.else.branch.and.should.be.simplified"), SimplifyFix(usedAsExpression) ) } @@ -39,7 +40,7 @@ class WhenWithOnlyElseInspection : AbstractKotlinInspection() { ) : LocalQuickFix { override fun getFamilyName() = name - override fun getName() = "Simplify expression" + override fun getName() = KotlinBundle.message("simplify.fix.text") override fun applyFix(project: Project, descriptor: ProblemDescriptor) { val whenExpression = descriptor.psiElement as? KtWhenExpression ?: return diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/WrapUnaryOperatorInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/WrapUnaryOperatorInspection.kt index b59e8b31ec7..99f3dac378e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/inspections/WrapUnaryOperatorInspection.kt +++ b/idea/src/org/jetbrains/kotlin/idea/inspections/WrapUnaryOperatorInspection.kt @@ -13,6 +13,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiElementVisitor import com.intellij.psi.tree.IElementType import org.jetbrains.kotlin.KtNodeTypes +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.idea.intentions.getLeftMostReceiverExpression import org.jetbrains.kotlin.idea.intentions.replaceFirstReceiver import org.jetbrains.kotlin.lexer.KtTokens @@ -33,7 +34,7 @@ class WrapUnaryOperatorInspection : AbstractKotlinInspection() { ) { holder.registerProblem( expression, - "Wrap unary operator and value with ()", + KotlinBundle.message("wrap.unary.operator.quickfix.text"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, WrapUnaryOperatorQuickfix() ) @@ -46,7 +47,7 @@ class WrapUnaryOperatorInspection : AbstractKotlinInspection() { private fun IElementType.isUnaryMinusOrPlus() = this == KtTokens.MINUS || this == KtTokens.PLUS private class WrapUnaryOperatorQuickfix : LocalQuickFix { - override fun getName() = "Wrap unary operator and value with ()" + override fun getName() = KotlinBundle.message("wrap.unary.operator.quickfix.text") override fun getFamilyName() = name diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveReturnLabelFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveReturnLabelFix.kt index ce6bdb840b4..0b2cb7deb2e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveReturnLabelFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/RemoveReturnLabelFix.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.quickfix import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import org.jetbrains.kotlin.diagnostics.Diagnostic +import org.jetbrains.kotlin.idea.KotlinBundle import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtReturnExpression @@ -16,9 +17,9 @@ class RemoveReturnLabelFix(element: KtReturnExpression, private val labelName: S element?.labeledExpression?.delete() } - override fun getFamilyName(): String = "Remove redundant label" + override fun getFamilyName(): String = KotlinBundle.message("remove.return.label.fix.family") - override fun getText(): String = "Remove redundant '@$labelName'" + override fun getText(): String = KotlinBundle.message("remove.return.label.fix.text", labelName) companion object : KotlinSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic): KotlinQuickFixAction? { diff --git a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/ui/AbstractParameterTablePanel.kt b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/ui/AbstractParameterTablePanel.kt index 5c802794509..0dfec51131e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/ui/AbstractParameterTablePanel.kt +++ b/idea/src/org/jetbrains/kotlin/idea/refactoring/introduce/ui/AbstractParameterTablePanel.kt @@ -76,7 +76,7 @@ abstract class AbstractParameterTablePanel