mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
[HUDSON-1670] use Localizables as parameters to another Localizable when creating
a HealthReport (for both Build Stability and Test Results). When already-translated strings are used, these go into the cached health report, so all users see language of the person who cached it rather than their own language. Localizer package needs a fix so that Localizable.toString() defaults to LocaleProvider.getLocale() rather than Locale.getDefault().. then these strings will translate correctly to the language of the current request. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15320 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
167f181c59
commit
a3bac8aa3e
2 files changed
+8
-7
No files matched your search
@@ -89,6 +89,7 @@ import org.jfree.chart.plot.PlotOrientation;
|
||||
import org.jfree.chart.renderer.category.StackedAreaRenderer;
|
||||
import org.jfree.data.category.CategoryDataset;
|
||||
import org.jfree.ui.RectangleInsets;
|
||||
import org.jvnet.localizer.Localizable;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.WebMethod;
|
||||
@@ -860,16 +861,16 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
|
||||
score--;
|
||||
}
|
||||
|
||||
String description;
|
||||
Localizable description;
|
||||
if (failCount == 0) {
|
||||
description = Messages.Job_NoRecentBuildFailed();
|
||||
description = Messages._Job_NoRecentBuildFailed();
|
||||
} else if (totalCount == failCount) {
|
||||
// this should catch the case where totalCount == 1
|
||||
// as failCount must be between 0 and totalCount
|
||||
// and we can't get here if failCount == 0
|
||||
description = Messages.Job_AllRecentBuildFailed();
|
||||
description = Messages._Job_AllRecentBuildFailed();
|
||||
} else {
|
||||
description = Messages.Job_NOfMFailed(failCount, totalCount);
|
||||
description = Messages._Job_NOfMFailed(failCount, totalCount);
|
||||
}
|
||||
return new HealthReport(score, Messages._Job_BuildStability(description));
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ public abstract class AbstractTestResultAction<T extends AbstractTestResultActio
|
||||
final int totalCount = getTotalCount();
|
||||
final int failCount = getFailCount();
|
||||
int score = (totalCount == 0) ? 100 : (int) (100.0 * (1.0 - ((double)failCount) / totalCount));
|
||||
Localizable description;
|
||||
Localizable description, displayName = Messages._AbstractTestResultAction_getDisplayName();
|
||||
if (totalCount == 0) {
|
||||
description = Messages._AbstractTestResultAction_zeroTestDescription(getDisplayName());
|
||||
description = Messages._AbstractTestResultAction_zeroTestDescription(displayName);
|
||||
} else {
|
||||
description = Messages._AbstractTestResultAction_TestsDescription(getDisplayName(), failCount, totalCount);
|
||||
description = Messages._AbstractTestResultAction_TestsDescription(displayName, failCount, totalCount);
|
||||
}
|
||||
return new HealthReport(score, description);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user