mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
format ordinal numbers after ten correctly (IDEA-202990)
This commit is contained in:
@@ -57,9 +57,9 @@ change.method.signature.from.usage.family=Change method signature from usage
|
||||
|
||||
# {0} - original method signature including name, {1} - method name, {2} - proposed new parameters list
|
||||
change.method.signature.from.usage.text=Change signature of ''{0}'' to ''{1}({2})''
|
||||
add.parameter.from.usage.text=Add ''{0}'' as {1, choice, 1#1st|2#2nd|3#3rd|4#{1,number}th} parameter to method ''{2}''
|
||||
remove.parameter.from.usage.text=Remove {0, choice, 1#1st|2#2nd|3#3rd|4#{0,number}th} parameter from method ''{1}''
|
||||
change.parameter.from.usage.text=Change {0, choice, 1#1st|2#2nd|3#3rd|4#{0,number}th} parameter of method ''{1}'' from ''{2}'' to ''{3}''
|
||||
add.parameter.from.usage.text=Add ''{0}'' as {1} parameter to method ''{2}''
|
||||
remove.parameter.from.usage.text=Remove {0} parameter from method ''{1}''
|
||||
change.parameter.from.usage.text=Change {0} parameter of method ''{1}'' from ''{2}'' to ''{3}''
|
||||
searching.for.usages.progress.title=Searching For Usages...
|
||||
create.class.from.new.family=Create Class from New
|
||||
create.class.from.new.text=Create class ''{0}''
|
||||
|
||||
+3
-3
@@ -107,15 +107,15 @@ public class ChangeMethodSignatureFromUsageFix implements IntentionAction/*, Hig
|
||||
if (newParams.size() == 1) {
|
||||
final ParameterInfoImpl p = newParams.iterator().next();
|
||||
return QuickFixBundle
|
||||
.message("add.parameter.from.usage.text", p.getTypeText(), (ArrayUtil.find(myNewParametersInfo, p) + 1), targetMethodName);
|
||||
.message("add.parameter.from.usage.text", p.getTypeText(), StringUtil.formatOrdinal(ArrayUtil.find(myNewParametersInfo, p) + 1), targetMethodName);
|
||||
}
|
||||
if (removedParams.size() == 1) {
|
||||
final ParameterInfoImpl p = removedParams.iterator().next();
|
||||
return QuickFixBundle.message("remove.parameter.from.usage.text", (p.getOldIndex() + 1), targetMethodName);
|
||||
return QuickFixBundle.message("remove.parameter.from.usage.text", StringUtil.formatOrdinal(p.getOldIndex() + 1), targetMethodName);
|
||||
}
|
||||
if (changedParams.size() == 1) {
|
||||
final ParameterInfoImpl p = changedParams.iterator().next();
|
||||
return QuickFixBundle.message("change.parameter.from.usage.text", (p.getOldIndex() + 1), targetMethodName,
|
||||
return QuickFixBundle.message("change.parameter.from.usage.text", StringUtil.formatOrdinal(p.getOldIndex() + 1), targetMethodName,
|
||||
myTargetMethod.getParameterList().getParameters()[p.getOldIndex()].getType().getPresentableText(),
|
||||
p.getTypeText());
|
||||
}
|
||||
|
||||
@@ -1634,6 +1634,25 @@ public class StringUtil extends StringUtilRt {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String formatOrdinal(int i) {
|
||||
int mod = i % 100;
|
||||
if (mod == 11 || mod == 12 || mod == 13) {
|
||||
return i + "th";
|
||||
}
|
||||
|
||||
mod = mod % 10;
|
||||
if (mod == 1) {
|
||||
return i + "st";
|
||||
}
|
||||
else if (mod == 2) {
|
||||
return i + "nd";
|
||||
}
|
||||
else if (mod == 3) {
|
||||
return i + "rd";
|
||||
}
|
||||
return i + "th";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns unpluralized variant using English based heuristics like properties -> property, names -> name, children -> child.
|
||||
* Returns {@code null} if failed to match appropriate heuristic.
|
||||
|
||||
Reference in New Issue
Block a user