You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/07/22 15:55:56 UTC
svn commit: r678765 - in
/maven/plugins/trunk/maven-project-info-reports-plugin/src/main:
java/org/apache/maven/report/projectinfo/dependencies/renderer/ resources/
Author: vsiveton
Date: Tue Jul 22 06:55:56 2008
New Revision: 678765
URL: http://svn.apache.org/viewvc?rev=678765&view=rev
Log:
o internationalize kB, MB, GB according the internationalize SI units
o added French translation for ko Mo Go
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties
Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java?rev=678765&r1=678764&r2=678765&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java Tue Jul 22 06:55:56 2008
@@ -85,9 +85,6 @@
/** Used to format decimal values in the "Dependency File Details" table */
protected static final DecimalFormat DEFAULT_DECIMAL_FORMAT = new DecimalFormat( "#,##0" );
- /** Used to format file length values */
- private static final DecimalFormat FILE_LENGTH_DECIMAL_FORMAT = new FileDecimalFormat();
-
private static final Set JAR_SUBTYPE = new HashSet();
/**
@@ -95,14 +92,14 @@
*/
private static final String JAVASCRIPT;
- private final Locale locale;
-
private final DependencyNode dependencyTreeNode;
private final Dependencies dependencies;
private final DependenciesReportConfiguration configuration;
+ private final Locale locale;
+
private final I18N i18n;
private final Log log;
@@ -111,6 +108,9 @@
private final RepositoryUtils repoUtils;
+ /** Used to format file length values */
+ private final DecimalFormat fileLengthDecimalFormat;
+
/**
* Will be filled with license name / set of projects.
*/
@@ -219,7 +219,8 @@
// Using the right set of symbols depending of the locale
DEFAULT_DECIMAL_FORMAT.setDecimalFormatSymbols( new DecimalFormatSymbols( locale ) );
- FILE_LENGTH_DECIMAL_FORMAT.setDecimalFormatSymbols( new DecimalFormatSymbols( locale ) );
+ this.fileLengthDecimalFormat = new FileDecimalFormat( i18n, locale );
+ this.fileLengthDecimalFormat.setDecimalFormatSymbols( new DecimalFormatSymbols( locale ) );
}
// ----------------------------------------------------------------------
@@ -411,7 +412,7 @@
sink.tableRows( justification, true );
TotalCell totaldeps = new TotalCell( DEFAULT_DECIMAL_FORMAT );
- TotalCell totaldepsize = new TotalCell( FILE_LENGTH_DECIMAL_FORMAT );
+ TotalCell totaldepsize = new TotalCell( fileLengthDecimalFormat );
TotalCell totalentries = new TotalCell( DEFAULT_DECIMAL_FORMAT );
TotalCell totalclasses = new TotalCell( DEFAULT_DECIMAL_FORMAT );
TotalCell totalpackages = new TotalCell( DEFAULT_DECIMAL_FORMAT );
@@ -489,7 +490,7 @@
tableRow( hasSealed, new String[] {
artifactFile.getName(),
- FILE_LENGTH_DECIMAL_FORMAT.format( artifactFile.length() ),
+ fileLengthDecimalFormat.format( artifactFile.length() ),
DEFAULT_DECIMAL_FORMAT.format( jarDetails.getNumEntries() ),
DEFAULT_DECIMAL_FORMAT.format( jarDetails.getNumClasses() ),
DEFAULT_DECIMAL_FORMAT.format( jarDetails.getNumPackages() ),
@@ -505,7 +506,7 @@
else
{
tableRow( hasSealed, new String[] { artifactFile.getName(),
- FILE_LENGTH_DECIMAL_FORMAT.format( artifactFile.length() ), "", "", "", "", "", "" } );
+ fileLengthDecimalFormat.format( artifactFile.length() ), "", "", "", "", "", "" } );
}
}
@@ -1322,19 +1323,36 @@
}
/**
- * Formats file length with the associated unit (GB, MB, KB) and using the pattern
- * <code>########.00</code> by default.
+ * Formats file length with the associated <a href="http://en.wikipedia.org/wiki/SI_prefix#Computing">SI</a>
+ * unit (GB, MB, kB) and using the pattern <code>########.00</code> by default.
+ *
+ * @see <a href="http://en.wikipedia.org/wiki/SI_prefix#Computing>
+ * http://en.wikipedia.org/wiki/SI_prefix#Computing</a>
+ * @see <a href="http://en.wikipedia.org/wiki/Binary_prefix">
+ * http://en.wikipedia.org/wiki/Binary_prefix</a>
+ * @see <a href="http://en.wikipedia.org/wiki/Octet_(computing)">
+ * http://en.wikipedia.org/wiki/Octet_(computing)</a>
*/
static class FileDecimalFormat extends DecimalFormat
{
private static final long serialVersionUID = 4062503546523610081L;
+ private final I18N i18n;
+
+ private final Locale locale;
+
/**
* Default constructor
+ *
+ * @param i18n
+ * @param locale
*/
- public FileDecimalFormat()
+ public FileDecimalFormat( I18N i18n, Locale locale )
{
super( "#,###.00" );
+
+ this.i18n = i18n;
+ this.locale = locale;
}
/** {@inheritDoc} */
@@ -1343,19 +1361,19 @@
if ( fs > 1024 * 1024 * 1024 )
{
result = super.format( (float) fs / ( 1024 * 1024 * 1024 ), result, fieldPosition );
- result.append( " GB" );
+ result.append( " " ).append( i18n.getString( "project-info-report", locale, "report.dependencies.file.details.column.size.gb" ) );
return result;
}
if ( fs > 1024 * 1024 )
{
result = super.format( (float) fs / ( 1024 * 1024 ), result, fieldPosition );
- result.append( " MB" );
+ result.append( " " ).append( i18n.getString( "project-info-report", locale, "report.dependencies.file.details.column.size.mb" ) );
return result;
}
result = super.format( (float) fs / ( 1024 ), result, fieldPosition );
- result.append( " KB" );
+ result.append( " " ).append( i18n.getString( "project-info-report", locale, "report.dependencies.file.details.column.size.kb" ) );
return result;
}
}
Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties?rev=678765&r1=678764&r2=678765&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties Tue Jul 22 06:55:56 2008
@@ -55,6 +55,9 @@
report.dependencies.file.details.column.packages = Packages
report.dependencies.file.details.column.sealed = Sealed
report.dependencies.file.details.column.size = Size
+report.dependencies.file.details.column.size.gb = GB
+report.dependencies.file.details.column.size.mb = MB
+report.dependencies.file.details.column.size.kb = kB
report.dependencies.file.details.title = Dependency File Details
report.dependencies.file.details.total = Total
report.dependencies.graph.tables.licenses = Licenses
Modified: maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties?rev=678765&r1=678764&r2=678765&view=diff
==============================================================================
--- maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties (original)
+++ maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties Tue Jul 22 06:55:56 2008
@@ -55,6 +55,9 @@
report.dependencies.file.details.column.packages = Packages
report.dependencies.file.details.column.sealed = Scell\u00e9
report.dependencies.file.details.column.size = Taille
+report.dependencies.file.details.column.size.gb = Go
+report.dependencies.file.details.column.size.mb = Mo
+report.dependencies.file.details.column.size.kb = ko
report.dependencies.file.details.title = D\u00e9tails du fichier de d\u00e9pendances
report.dependencies.file.details.total = Total
report.dependencies.graph.tables.licenses = Licences