Internatinalization

GitOrigin-RevId: 54277418c48c95ac8065d4e18a65dd78f930bb3a
This commit is contained in:
Tagir Valeev
2020-01-24 06:32:55 +00:00
committed by intellij-monorepo-bot
parent 79b69afe58
commit e512fa3c6a
11 changed files with 38 additions and 28 deletions
@@ -1,6 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection;
import com.intellij.codeInsight.daemon.QuickFixBundle;
import com.intellij.codeInsight.intention.LowPriorityAction;
import com.intellij.codeInspection.ex.InspectionProfileModifiableModelKt;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
@@ -14,6 +15,7 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -24,7 +26,7 @@ public class SetInspectionOptionFix implements LocalQuickFix, LowPriorityAction,
private final String myMessage;
private final boolean myValue;
public SetInspectionOptionFix(LocalInspectionTool inspection, String property, String message, boolean value) {
public SetInspectionOptionFix(LocalInspectionTool inspection, @NonNls String property, @Nls String message, boolean value) {
myID = inspection.getID();
myProperty = property;
myMessage = message;
@@ -42,7 +44,7 @@ public class SetInspectionOptionFix implements LocalQuickFix, LowPriorityAction,
@NotNull
@Override
public String getFamilyName() {
return "Set inspection option";
return QuickFixBundle.message("set.inspection.option.fix");
}
@Override
@@ -61,7 +61,7 @@ public class UseCompareMethodInspection extends AbstractBaseJavaLocalInspectionT
}
private void register(CompareInfo info, PsiElement nameElement) {
holder.registerProblem(nameElement, "Can be replaced with '" + info.myClass.getClassName() + ".compare'",
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.can.be.replaced.with.message", info.myClass.getClassName() + ".compare"),
new ReplaceWithPrimitiveCompareFix(info.getReplacementText()));
}
};
@@ -338,7 +338,7 @@ public class UseCompareMethodInspection extends AbstractBaseJavaLocalInspectionT
@NotNull
@Override
public String getFamilyName() {
return "Replace with single comparison method";
return InspectionsBundle.message("inspection.use.compare.method.fix.family.name");
}
@Override
@@ -381,4 +381,5 @@ choose.default.value.parameters.popup.title=Choose Default Value Parameters
generate.overloaded.method.or.constructor.with.default.parameter.values=Generate overloaded {0} with default parameter values
generate.overloaded.method.with.default.parameter.values=Generate overloaded method with default parameter values
remove.unreachable.branches=Remove unreachable branches
remove.unreachable.branches=Remove unreachable branches
set.inspection.option.fix=Set inspection option
@@ -26,7 +26,8 @@ public class OptionalAssignedToNullInspection extends AbstractBaseJavaLocalInspe
@Nullable
@Override
public JComponent createOptionsPanel() {
return new SingleCheckboxOptionsPanel("Report comparison of Optional with null", this, "WARN_ON_COMPARISON");
return new SingleCheckboxOptionsPanel(InspectionsBundle.message("inspection.null.value.for.optional.option.comparisons"),
this, "WARN_ON_COMPARISON");
}
@NotNull
@@ -87,10 +88,11 @@ public class OptionalAssignedToNullInspection extends AbstractBaseJavaLocalInspe
if (value != null &&
TypeUtils.isOptional(value.getType()) &&
!hasSubsequentIsPresentCall(value, binOp, JavaTokenType.EQEQ.equals(binOp.getOperationTokenType()))) {
holder.registerProblem(binOp, "Optional value is compared with null",
holder.registerProblem(binOp, InspectionsBundle.message("inspection.null.value.for.optional.assigned.message"),
new ReplaceWithIsPresentFix(),
new SetInspectionOptionFix(OptionalAssignedToNullInspection.this, "WARN_ON_COMPARISON",
"Do not warn when comparing Optional with null", false));
InspectionsBundle
.message("inspection.null.value.for.optional.assigned.ignore.fix.name"), false));
}
}
@@ -152,7 +154,7 @@ public class OptionalAssignedToNullInspection extends AbstractBaseJavaLocalInspe
@NotNull
@Override
public String getName() {
return InspectionsBundle.message("inspection.null.value.for.optional.fix.name",
return CommonQuickFixBundle.message("fix.replace.with.x",
StringUtil.getShortName(myTypeName) + "." + myMethodName + "()");
}
@@ -178,7 +180,7 @@ public class OptionalAssignedToNullInspection extends AbstractBaseJavaLocalInspe
@NotNull
@Override
public String getFamilyName() {
return "Replace with 'isPresent()' call";
return CommonQuickFixBundle.message("fix.replace.with.x", "isPresent()");
}
@Override
@@ -63,7 +63,8 @@ public class Java8MapForEachInspection extends AbstractBaseJavaLocalInspectionTo
PsiParameter entry = lambdaParameters[0];
if (!allUsagesAllowed(entry)) return;
PsiElement nameElement = Objects.requireNonNull(call.getMethodExpression().getReferenceNameElement());
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.map.foreach.message"), new ReplaceWithMapForEachFix());
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.can.be.replaced.with.message", "Map.forEach()"),
new ReplaceWithMapForEachFix());
}
private boolean allUsagesAllowed(@NotNull PsiParameter entry) {
@@ -98,7 +99,7 @@ public class Java8MapForEachInspection extends AbstractBaseJavaLocalInspectionTo
toHighlight = firstChild;
range = new TextRange(0, firstChild.getTextLength());
}
holder.registerProblem(toHighlight, InspectionsBundle.message("inspection.map.foreach.message"),
holder.registerProblem(toHighlight, InspectionsBundle.message("inspection.can.be.replaced.with.message", "Map.forEach()"),
type, range, new ReplaceWithMapForEachFix());
}
}
@@ -110,7 +111,7 @@ public class Java8MapForEachInspection extends AbstractBaseJavaLocalInspectionTo
@NotNull
@Override
public String getFamilyName() {
return InspectionsBundle.message("inspection.map.foreach.fix.name");
return CommonQuickFixBundle.message("fix.replace.with.x", "Map.forEach()");
}
@Override
@@ -27,7 +27,7 @@ public class ExplicitArgumentCanBeLambdaInspection extends AbstractBaseJavaLocal
for(LambdaAndExplicitMethodPair info : LambdaAndExplicitMethodPair.INFOS) {
PsiExpression arg = info.getLambdaCandidateFromExplicitCall(call);
if(arg != null && !(arg instanceof PsiEmptyExpressionImpl) && !ExpressionUtils.isSafelyRecomputableExpression(arg)) {
holder.registerProblem(arg, "Explicit argument can be converted to lambda",
holder.registerProblem(arg, InspectionsBundle.message("inspection.explicit.argument.can.be.lambda.message"),
new ConvertExplicitCallToLambdaFix(info, info.getLambdaMethodName(call)));
return;
}
@@ -819,11 +819,10 @@ inspection.excessive.lambda.message=Excessive lambda usage
inspection.excessive.lambda.fix.family.name=Replace lambda with constant
inspection.excessive.lambda.fix.name=Use ''{0}'' method without lambda
inspection.explicit.argument.can.be.lambda.message=Explicit argument can be converted to function
inspection.explicit.argument.can.be.lambda.message=Explicit argument can be converted to lambda
inspection.explicit.argument.can.be.lambda.fix.family.name=Replace explicit argument with function
inspection.explicit.argument.can.be.lambda.fix.name=Use ''{0}'' method with functional argument
inspection.lambda.to.method.call.message=Can be replaced with ''{0}''
inspection.lambda.to.method.call.fix.family.name=Replace lambda expression with method call
inspection.lambda.to.method.call.fix.name=Replace lambda expression with ''{0}''
@@ -880,8 +879,6 @@ inspection.redundant.stream.optional.call.fix.collect.to.ordered.family.name=Col
inspection.redundant.stream.optional.call.option.streamboxing=Report redundant boxing in Stream.map
inspection.map.foreach.display.name=Map.forEach() can be used
inspection.map.foreach.message=Can be replaced with 'Map.forEach()'
inspection.map.foreach.fix.name=Replace with 'Map.forEach()'
inspection.map.foreach.option.no.loops=Do not report loops
inspection.simplify.foreach.display.name=Simplifiable forEach() call
@@ -894,7 +891,8 @@ inspection.collection.factories.fix.name=Replace with ''{0}.{1}'' call
inspection.null.value.for.optional.message=Null is used for ''Optional'' type in {0}
inspection.null.value.for.optional.fix.family.name=Replace with empty Optional method
inspection.null.value.for.optional.fix.name=Replace with ''{0}''
inspection.null.value.for.optional.assigned.message=Optional value is compared with null
inspection.null.value.for.optional.assigned.ignore.fix.name=Do not warn when comparing Optional with null
inspection.null.value.for.optional.context.assignment=assignment
inspection.null.value.for.optional.context.parameter=parameter
inspection.null.value.for.optional.context.lambda=lambda expression
@@ -1047,7 +1045,6 @@ inspection.class.getclass.fix.remove.name=Remove 'getClass()' call
inspection.class.getclass.fix.replace.name=Replace with 'Class.class'
redundant.backticks.around.raw.string.literal.display.name=Redundant backticks around raw string literal
inspection.objects.equals.can.be.simplified.display.name=Objects.equals() can be replaced with equals()
inspection.objects.equals.can.be.simplified.message=Can be replaced with ''{0}''
inspection.duplicate.expressions.display.name=Multiple occurrences of the same expression
inspection.duplicate.expressions.message=Multiple occurrences of <code>#ref</code> #loc
@@ -1109,4 +1106,9 @@ inspection.redundant.operation.on.empty.map.message=Map <code>#ref</code> is alw
inspection.collection.used.as.vararg.display.name=Iterable is used as vararg
inspection.collection.used.as.vararg.message=Iterable is passed as vararg: probably an array was intended
inspection.manual.min.max.calculation.description=Can be replaced with ''Math.{0}'' call
inspection.manual.min.max.calculation.disable.for.non.integral=Disable for float and double
inspection.manual.min.max.calculation.disable.for.non.integral=Disable for float and double
inspection.use.compare.method.fix.family.name=Replace with single comparison method
inspection.can.be.replaced.with.message=Can be replaced with ''{0}''
inspection.null.value.for.optional.option.comparisons=Report comparison of Optional with null
@@ -3,6 +3,7 @@ package com.intellij.codeInspection.ui;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.util.ui.JBInsets;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
@@ -26,11 +27,11 @@ public class MultipleCheckboxOptionsPanel extends JPanel {
myOptionAccessor = optionAccessor;
}
public void addCheckbox(String label, @NonNls String property) {
public void addCheckbox(@Nls String label, @NonNls String property) {
addCheckboxEx(label, property);
}
public JCheckBox addCheckboxEx(String label, @NonNls String property) {
public JCheckBox addCheckboxEx(@Nls String label, @NonNls String property) {
final boolean selected = myOptionAccessor.getOption(property);
final JCheckBox checkBox = new JCheckBox(label, selected);
checkBox.addItemListener(e -> myOptionAccessor.setOption(property, e.getStateChange() == ItemEvent.SELECTED));
@@ -38,7 +39,7 @@ public class MultipleCheckboxOptionsPanel extends JPanel {
return checkBox;
}
public JCheckBox addDependentCheckBox(String label, @NonNls String property, JCheckBox controller) {
public JCheckBox addDependentCheckBox(@Nls String label, @NonNls String property, JCheckBox controller) {
final JCheckBox checkBox = addCheckboxEx(label, property);
checkBox.setBorder(new EmptyBorder(new JBInsets(0, 30, 0, 0)));
controller.addItemListener(
@@ -17,6 +17,7 @@ package com.intellij.codeInspection.ui;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -27,7 +28,7 @@ import java.awt.*;
public class SingleCheckboxOptionsPanel extends JPanel {
public SingleCheckboxOptionsPanel(@NotNull String label,
public SingleCheckboxOptionsPanel(@NotNull @Nls String label,
@NotNull InspectionProfileEntry owner,
@NonNls String property) {
super(new GridBagLayout());
@@ -52,7 +52,7 @@ public class ObjectsEqualsCanBeSimplifiedInspection extends AbstractBaseJavaLoca
return;
}
}
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.objects.equals.can.be.simplified.message", "equals()"),
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.can.be.replaced.with.message", "equals()"),
new ReplaceWithEqualsFix(false));
}
}
@@ -61,7 +61,7 @@ public class ObjectsEqualsCanBeSimplifiedInspection extends AbstractBaseJavaLoca
PsiType type1 = arg1.getType();
PsiType type2 = arg2.getType();
if (type1 instanceof PsiPrimitiveType && type1.equals(type2) && !TypeConversionUtil.isFloatOrDoubleType(type1)) {
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.objects.equals.can.be.simplified.message", "=="),
holder.registerProblem(nameElement, InspectionsBundle.message("inspection.can.be.replaced.with.message", "=="),
new ReplaceWithEqualsFix(true));
return true;
}
@@ -119,7 +119,7 @@ public class LambdaCanBeMethodCallInspection extends AbstractBaseJavaLocalInspec
}
private void registerProblem(PsiLambdaExpression lambda, String displayReplacement, String replacement) {
holder.registerProblem(lambda, InspectionsBundle.message("inspection.lambda.to.method.call.message", displayReplacement),
holder.registerProblem(lambda, InspectionsBundle.message("inspection.can.be.replaced.with.message", displayReplacement),
new ReplaceWithFunctionCallFix(replacement, displayReplacement));
}
};