diff --git a/maven-reports/maven-pmd-plugin/pom.xml b/maven-reports/maven-pmd-plugin/pom.xml index df19d6f32f..d0d725116c 100644 --- a/maven-reports/maven-pmd-plugin/pom.xml +++ b/maven-reports/maven-pmd-plugin/pom.xml @@ -6,7 +6,7 @@ 2.0-alpha-3 maven-pmd-plugin - 2.0-alpha-1 + 2.0-alpha-2-SNAPSHOT maven-plugin Maven PMD Plugin 2005 diff --git a/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java b/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java index 80b2ee6f80..143df3b241 100644 --- a/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java +++ b/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java @@ -40,6 +40,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.ResourceBundle; /** * Implement the PMD report. @@ -78,7 +79,7 @@ public class PmdReport */ public String getName( Locale locale ) { - return "PMD report"; + return getBundle( locale ).getString( "report.pmd.name" ); } /** @@ -86,7 +87,7 @@ public class PmdReport */ public String getDescription( Locale locale ) { - return "Verification of coding rules."; + return getBundle( locale ).getString( "report.pmd.description" ); } /** @@ -134,7 +135,7 @@ public class PmdReport Report report = new Report(); // TODO: use source roots instead String sourceDirectory = getProject().getBuild().getSourceDirectory(); - PmdReportListener reportSink = new PmdReportListener( sink, sourceDirectory ); + PmdReportListener reportSink = new PmdReportListener( sink, sourceDirectory, getBundle( locale ) ); report.addListener( reportSink ); ruleContext.setReport( report ); @@ -233,4 +234,9 @@ public class PmdReport return FileUtils.getFiles( dir, includes, excludesStr.toString() ); } + + private static ResourceBundle getBundle( Locale locale ) + { + return ResourceBundle.getBundle("pmd-report", locale, PmdReport.class.getClassLoader() ); + } } diff --git a/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java b/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java index cf703e09a2..3db0a0b713 100644 --- a/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java +++ b/maven-reports/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReportListener.java @@ -23,6 +23,7 @@ import org.codehaus.doxia.sink.Sink; import org.codehaus.plexus.util.StringUtils; import java.io.File; +import java.util.ResourceBundle; /** * Handle events from PMD, converting them into Doxia events. @@ -33,8 +34,6 @@ import java.io.File; public class PmdReportListener implements ReportListener { - private static final String TITLE = "PMD Results"; - private Sink sink; private String sourceDirectory; @@ -43,10 +42,18 @@ public class PmdReportListener private boolean fileInitialized; - public PmdReportListener( Sink sink, String sourceDirectory ) + private ResourceBundle bundle; + + public PmdReportListener( Sink sink, String sourceDirectory, ResourceBundle bundle ) { this.sink = sink; this.sourceDirectory = sourceDirectory; + this.bundle = bundle; + } + + private String getTitle() + { + return bundle.getString( "report.pmd.title" ); } public void ruleViolationAdded( RuleViolation ruleViolation ) @@ -61,10 +68,10 @@ public class PmdReportListener sink.table(); sink.tableRow(); sink.tableHeaderCell(); - sink.text( "Violation" ); + sink.text( bundle.getString( "report.pmd.column.violation" ) ); sink.tableHeaderCell_(); sink.tableHeaderCell(); - sink.text( "Line" ); + sink.text( bundle.getString( "report.pmd.column.line" ) ); sink.tableHeaderCell_(); sink.tableRow_(); @@ -90,7 +97,7 @@ public class PmdReportListener { sink.head(); sink.title(); - sink.text( TITLE ); + sink.text( getTitle() ); sink.title_(); sink.head_(); @@ -98,11 +105,11 @@ public class PmdReportListener sink.section1(); sink.sectionTitle1(); - sink.text( TITLE ); + sink.text( getTitle() ); sink.sectionTitle1_(); sink.paragraph(); - sink.text( "The following document contains the results of " ); + sink.text( bundle.getString( "report.pmd.pmdlink" ) + " " ); sink.link( "http://pmd.sourceforge.net/" ); sink.text( "PMD" ); sink.link_(); @@ -112,7 +119,7 @@ public class PmdReportListener sink.section1_(); sink.sectionTitle1(); - sink.text( "Files" ); + sink.text( bundle.getString( "report.pmd.files" ) ); sink.sectionTitle1_(); // TODO files summary