diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 529a2e2ccf..0c2d721812 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -18,6 +18,7 @@ import org.jvnet.animal_sniffer.IgnoreJRERequirement; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; + import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -339,7 +340,7 @@ public class Util { } /** - * Gets a human readable mesasge for the given Win32 error code. + * Gets a human readable message for the given Win32 error code. * * @return * null if no such message is available. @@ -462,7 +463,7 @@ public class Util { } /** - * Covnerts a string into 128-bit AES key. + * Converts a string into 128-bit AES key. * @since 1.308 */ public static SecretKey toAes128Key(String s) { @@ -547,9 +548,9 @@ public class Util { /** - * Create a string representation of a time duration. If the quanity of + * Create a string representation of a time duration. If the quantity of * the most significant unit is big (>=10), then we use only that most - * significant unit in the string represenation. If the quantity of the + * significant unit in the string representation. If the quantity of the * most significant unit is small (a single-digit value), then we also * use a secondary, smaller unit for increased precision. * So 13 minutes and 43 seconds returns just "13 minutes", but 3 minutes @@ -568,7 +569,7 @@ public class Util { /** * Get a human readable string representing strings like "xxx days ago", - * which should be used to point to the occurence of an event in the past. + * which should be used to point to the occurrence of an event in the past. */ public static String getPastTimeString(long duration) { return Messages.Util_pastTime(getTimeSpanString(duration)); @@ -577,11 +578,17 @@ public class Util { /** * Combines number and unit, with a plural suffix if needed. + * + * @deprecated + * Use individual localization methods instead. + * See {@link #Messages.Util_year(long)} for an example. + * Deprecated since 2009-06-24, remove method after 2009-12-24. */ public static String combine(long n, String suffix) { String s = Long.toString(n)+' '+suffix; if(n!=1) - s += Messages.Util_countSuffix(); + // Just adding an 's' won't work in most natural languages, even English has exception to the rule (e.g. copy/copies). + s += "s"; return s; } diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index f86715c06e..65efd55d2c 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -23,7 +23,6 @@ */ package hudson.model; -import static hudson.Util.combine; import hudson.AbortException; import hudson.BulkChange; import hudson.CloseProofOutputStream; @@ -1128,22 +1127,22 @@ public abstract class Run ,RunT extends Run,RunT extends Run0) - return new Summary(false,combine(trN.getFailCount(),"test failure")); + return new Summary(false, Messages.Run_Summary_TestFailures(trN.getFailCount())); else // ??? - return new Summary(false,"unstable"); + return new Summary(false, Messages.Run_Summary_Unstable()); } if(trP.getFailCount()==0) - return new Summary(true,combine(trN.getFailCount(),"test")+" started to fail"); + return new Summary(true, Messages.Run_Summary_TestsStartedToFail(trN.getFailCount())); if(trP.getFailCount() < trN.getFailCount()) - return new Summary(true,combine(trN.getFailCount()-trP.getFailCount(),"more test") - +" are failing ("+trN.getFailCount()+" total)"); + return new Summary(true, Messages.Run_Summary_MoreTestsFailing(trN.getFailCount()-trP.getFailCount(), trN.getFailCount())); if(trP.getFailCount() > trN.getFailCount()) - return new Summary(false,combine(trP.getFailCount()-trN.getFailCount(),"less test") - +" are failing ("+trN.getFailCount()+" total)"); + return new Summary(false, Messages.Run_Summary_LessTestsFailing(trP.getFailCount()-trN.getFailCount(), trN.getFailCount())); - return new Summary(false,combine(trN.getFailCount(),"test")+" are still failing"); + return new Summary(false, Messages.Run_Summary_TestsStillFailing(trN.getFailCount())); } } - return new Summary(false,"?"); + return new Summary(false, Messages.Run_Summary_Unknown()); } /** diff --git a/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java b/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java index a090d0ea2d..44e6ca3bec 100644 --- a/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java +++ b/core/src/main/java/hudson/tasks/test/AbstractTestResultAction.java @@ -299,11 +299,11 @@ public abstract class AbstractTestResultAction