You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/02/01 20:09:55 UTC
[maven-invoker-plugin] branch master updated: Use localized format to avoid space before colon in English
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 292df99 Use localized format to avoid space before colon in English
292df99 is described below
commit 292df992b44e3b849e77814261e9ba4f7ffc8ec6
Author: Piotrek Żygieło <pz...@users.noreply.github.com>
AuthorDate: Tue Feb 1 14:44:21 2022 +0100
Use localized format to avoid space before colon in English
---
.../maven/plugins/invoker/InvokerReport.java | 34 ++++++++++++++++------
src/main/resources/invoker-report.properties | 1 +
src/main/resources/invoker-report_fr.properties | 1 +
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
index bc02f60..87f757a 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
@@ -23,6 +23,7 @@ import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
+import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
@@ -99,12 +100,19 @@ public class InvokerReport
*/
private NumberFormat secondsFormat;
+ /**
+ * The format used to print build name and description.
+ */
+ private MessageFormat nameAndDescriptionFormat;
+
protected void executeReport( Locale locale )
throws MavenReportException
{
DecimalFormatSymbols symbols = new DecimalFormatSymbols( locale );
percentFormat = new DecimalFormat( getText( locale, "report.invoker.format.percent" ), symbols );
secondsFormat = new DecimalFormat( getText( locale, "report.invoker.format.seconds" ), symbols );
+ nameAndDescriptionFormat =
+ new MessageFormat( getText( locale, "report.invoker.format.name_with_description" ) );
Sink sink = getSink();
@@ -283,23 +291,31 @@ public class InvokerReport
{
Sink sink = getSink();
sink.tableRow();
+ sinkCell( sink, getBuildJobReportName( buildJob ) );
+ // FIXME image
+ sinkCell( sink, buildJob.getResult() );
+ sinkCell( sink, secondsFormat.format( buildJob.getTime() ) );
+ sinkCell( sink, buildJob.getFailureMessage() );
+ sink.tableRow_();
+ }
+
+ private String getBuildJobReportName( BuildJob buildJob )
+ {
StringBuilder buffer = new StringBuilder();
if ( !StringUtils.isEmpty( buildJob.getName() ) && !StringUtils.isEmpty( buildJob.getDescription() ) )
{
- buffer.append( buildJob.getName() );
- buffer.append( " : " );
- buffer.append( buildJob.getDescription() );
+ buffer.append( getFormattedName( buildJob.getName(), buildJob.getDescription() ) );
}
else
{
buffer.append( buildJob.getProject() );
}
- sinkCell( sink, buffer.toString() );
- // FIXME image
- sinkCell( sink, buildJob.getResult() );
- sinkCell( sink, secondsFormat.format( buildJob.getTime() ) );
- sinkCell( sink, buildJob.getFailureMessage() );
- sink.tableRow_();
+ return buffer.toString();
+ }
+
+ private String getFormattedName( String name, String description )
+ {
+ return nameAndDescriptionFormat.format( new Object[] { name, description } );
}
protected String getOutputDirectory()
diff --git a/src/main/resources/invoker-report.properties b/src/main/resources/invoker-report.properties
index a174ec8..5fe569d 100644
--- a/src/main/resources/invoker-report.properties
+++ b/src/main/resources/invoker-report.properties
@@ -33,3 +33,4 @@ report.invoker.detail.time = Time
report.invoker.detail.message = Message
report.invoker.format.percent = 0.0%
report.invoker.format.seconds = 0.0\u00A0s
+report.invoker.format.name_with_description = {0}: {1}
diff --git a/src/main/resources/invoker-report_fr.properties b/src/main/resources/invoker-report_fr.properties
index 64e4a5a..1d3393a 100644
--- a/src/main/resources/invoker-report_fr.properties
+++ b/src/main/resources/invoker-report_fr.properties
@@ -33,3 +33,4 @@ report.invoker.detail.time = Dur
report.invoker.detail.message = Message
report.invoker.format.percent = 0.0%
report.invoker.format.seconds = 0.0\u00A0s
+report.invoker.format.name_with_description = {0} : {1}