提交 8baca8d5 编写于 作者: S swiest

Deprecated Util.combine(long,String) method and rewrote its callers to use localizable resources.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19190 71c3de6d-444a-0410-be80-ed276b4c234a
上级 7dad16bb
......@@ -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;
}
......
......@@ -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 <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
if(getResult()==Result.SUCCESS) {
if(prev==null || prev.getResult()== Result.SUCCESS)
return new Summary(false,"stable");
return new Summary(false, Messages.Run_Summary_Stable());
else
return new Summary(false,"back to normal");
return new Summary(false, Messages.Run_Summary_BackToNormal());
}
if(getResult()==Result.FAILURE) {
RunT since = getPreviousNotFailedBuild();
if(since==null)
return new Summary(false,"broken for a long time");
return new Summary(false, Messages.Run_Summary_BrokenForALongTime());
if(since==prev)
return new Summary(true,"broken since this build");
return new Summary(false,"broken since "+since.getDisplayName());
return new Summary(true, Messages.Run_Summary_BrokenSinceThisBuild());
return new Summary(false, Messages.Run_Summary_BrokenSince(since.getDisplayName()));
}
if(getResult()==Result.ABORTED)
return new Summary(false,"aborted");
return new Summary(false, Messages.Run_Summary_Aborted());
if(getResult()==Result.UNSTABLE) {
if(((Run)this) instanceof Build) {
......@@ -1151,24 +1150,22 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
AbstractTestResultAction trP = prev==null ? null : ((Build) prev).getTestResultAction();
if(trP==null) {
if(trN!=null && trN.getFailCount()>0)
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());
}
/**
......
......@@ -299,11 +299,11 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
AbstractTestResultAction a = label.build.getAction(AbstractTestResultAction.class);
switch (row) {
case 0:
return String.valueOf(Util.combine(a.getFailCount(), "failure"));
return String.valueOf(Messages.AbstractTestResultAction_fail(a.getFailCount()));
case 1:
return String.valueOf(Util.combine(a.getSkipCount(), "skip"));
return String.valueOf(Messages.AbstractTestResultAction_skip(a.getSkipCount()));
default:
return String.valueOf(Util.combine(a.getTotalCount(), "test"));
return String.valueOf(Messages.AbstractTestResultAction_test(a.getTotalCount()));
}
}
};
......
......@@ -32,7 +32,6 @@ Util.hour ={0} hr
Util.day ={0} {0,choice,0#days|1#day|1<days}
Util.month ={0} mo
Util.year ={0} yr
Util.countSuffix=s
# ideally it should be "{0} ago" but this saves more space
# another implication of this is that where we use this,
......
......@@ -32,8 +32,6 @@ Util.hour ={0} {0,choice,0#Stunden|1#Stunde|1<Stunden}
Util.day ={0} {0,choice,0#Tage|1#Tag|1<Tage}
Util.month ={0} {0,choice,0#Monate|1#Monat|1<Monate}
Util.year ={0} {0,choice,0#Jahre|1#Jahr|1<Jahre}
# Note: The count suffix is not suitable for building plural forms in German.
Util.countSuffix=\
# ideally it should be "{0} ago" but this saves more space
# another implication of this is that where we use this,
......
......@@ -32,7 +32,6 @@ Util.hour ={0} h
Util.day ={0} j
Util.month ={0} mo.
Util.year ={0} an.
Util.countSuffix=s
# ideally it should be "{0} ago" but this saves more space
# another implication of this is that where we use this,
......
......@@ -31,6 +31,5 @@ Util.hour ={0} \u6642\u9593
Util.day ={0} \u65E5
Util.month ={0} \u30F6\u6708
Util.year ={0} \u5E74
Util.countSuffix=
Util.pastTime={0}\u524D
FilePath.TildaDoesntWork=''~'' \u306F\u3001Unix\u306E\u30B7\u30A7\u30EB\u3067\u306E\u307F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u3059\u3002
......@@ -31,7 +31,6 @@ Util.hour ={0} {0,choice,0#uren|1#uur|1<uren}
Util.day ={0} {0,choice,0#dagen|1#dag|1<dagen}
Util.month ={0} {0,choice,0#maanden|1#maand|1<maanden}
Util.year ={0} {0,choice,0#jaren|1#jaar|1<jaren}
Util.countSuffix=s
# ideally it should be "{0} ago" but this saves more space
# another implication of this is that where we use this,
......
......@@ -31,7 +31,6 @@ Util.hour ={0} {0,choice,0#horas|1#hora|1<horas}
Util.day ={0} {0,choice,0#dias|1#dia|1<dias}
Util.month ={0} {0,choice,0#meses|1#m\u00EAs|1<meses}
Util.year ={0} {0,choice,0#anos|1#ano|1<anos}
#Util.countSuffix=s
# ideally it should be "{0} ago" but this saves more space
# another implication of this is that where we use this,
......
......@@ -31,7 +31,6 @@ Util.hour ={0} {0,choice,0#saat|1#saat|1<saat}
Util.day ={0} {0,choice,0#g\u00fcn|1#g\u00fcn|1<g\u00fcn}
Util.month ={0} {0,choice,0#ay|1#ay|1<ay}
Util.year ={0} {0,choice,0#y\u0131l|1#y\u0131l|1<y\u0131l}
Util.countSuffix=s
# ideally it should be "{0} ago" but this saves more space
# another implication of this is that where we use this,
......
......@@ -125,9 +125,9 @@ Queue.InProgress=A build is already in progress
Queue.InQuietPeriod=In the quiet period. Expires in {0}
Queue.NodeOffline={0} is offline
Queue.Unknown=???
Queue.WaitingForNextAvailableExecutor=Waiting for next available executor
Queue.WaitingForNextAvailableExecutorOn=Waiting for next available executor on {0}
Run.BuildAborted=Build was aborted
Run.MarkedExplicitly=explicitly marked to keep the record
Run.Permissions.Title=Run
......@@ -138,6 +138,20 @@ Run.UpdatePermission.Description=\
This permission allows users to update description and other properties of a build, \
for example to leave notes about the cause of a build failure.
Run.Summary.Stable=stable
Run.Summary.Unstable=unstable
Run.Summary.Aborted=aborted
Run.Summary.BackToNormal=back to normal
Run.Summary.BrokenForALongTime=broken for a long time
Run.Summary.BrokenSinceThisBuild=broken since this build
Run.Summary.BrokenSince=broken since build {0}
Run.Summary.TestFailures={0} {0,choice,0#test failures|1#test failure|1<test failures}
Run.Summary.TestsStartedToFail={0} {0,choice,0#tests|1#test|1<tests} started to fail
Run.Summary.TestsStillFailing={0} {0,choice,0#tests are|1#test is|1<tests are} still failing
Run.Summary.MoreTestsFailing={0} more {0,choice,0#tests are|1#test is|1<tests are} failing (total {1})
Run.Summary.LessTestsFailing={0} less {0,choice,0#tests are|1#test is|1<tests are} failing (total {1})
Run.Summary.Unknown=?
Slave.InvalidConfig.Executors=Invalid slave configuration for {0}. Invalid # of executors.
Slave.InvalidConfig.NoName=Invalid slave configuration. Name is empty
Slave.InvalidConfig.NoRemoteDir=Invalid slave configuration for {0}. No remote directory given
......
......@@ -24,6 +24,10 @@ AbstractTestResultAction.getDisplayName=Test Result
AbstractTestResultAction.zeroTestDescription={0}: 0 tests in total.
AbstractTestResultAction.TestsDescription={0}: {1} tests failing out of a total of {2} tests.
AbstractTestResultAction.fail={0} {0,choice,0#failures|1#failure|1<failures}
AbstractTestResultAction.skip={0} {0,choice,0#skips|1#skip|1<skips}
AbstractTestResultAction.test={0} {0,choice,0#tests|1#test|1<tests}
AggregatedTestResultPublisher.DisplayName=Aggregate downstream test results
AggregatedTestResultPublisher.Title=Aggregated Test Result
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册