You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ev...@apache.org on 2005/06/23 16:49:56 UTC

svn commit: r193151 - in /maven/components/trunk/maven-reports/maven-checkstyle-plugin: pom.xml src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListener.java

Author: evenisse
Date: Thu Jun 23 07:49:54 2005
New Revision: 193151

URL: http://svn.apache.org/viewcvs?rev=193151&view=rev
Log:
Add i18n translations

Modified:
    maven/components/trunk/maven-reports/maven-checkstyle-plugin/pom.xml
    maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
    maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListener.java

Modified: maven/components/trunk/maven-reports/maven-checkstyle-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-reports/maven-checkstyle-plugin/pom.xml?rev=193151&r1=193150&r2=193151&view=diff
==============================================================================
--- maven/components/trunk/maven-reports/maven-checkstyle-plugin/pom.xml (original)
+++ maven/components/trunk/maven-reports/maven-checkstyle-plugin/pom.xml Thu Jun 23 07:49:54 2005
@@ -6,7 +6,7 @@
     <version>2.0-alpha-3</version>
   </parent>
   <artifactId>maven-checkstyle-plugin</artifactId>
-  <version>2.0-alpha-1</version>
+  <version>2.0-alpha-2-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
   <name>Maven Checkstyle Plugin</name>
   <inceptionYear>2005</inceptionYear>

Modified: maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java?rev=193151&r1=193150&r2=193151&view=diff
==============================================================================
--- maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java (original)
+++ maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReport.java Thu Jun 23 07:49:54 2005
@@ -42,6 +42,7 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Properties;
+import java.util.ResourceBundle;
 
 /**
  * @goal checkstyle
@@ -90,7 +91,7 @@
      */
     public String getName( Locale locale )
     {
-        return "Checkstyle";
+        return getBundle( locale ).getString( "report.checkstyle.name" );
     }
 
     /**
@@ -98,7 +99,7 @@
      */
     public String getDescription( Locale locale )
     {
-        return "Report on coding style conventions.";
+        return getBundle( locale ).getString( "report.checkstyle.description" );
     }
 
     /**
@@ -222,7 +223,7 @@
             checker.configure( config );
 
             // TODO: use source roots
-            AuditListener sinkListener = new CheckstyleReportListener( getSink(), sourceDirectory );
+            AuditListener sinkListener = new CheckstyleReportListener( getSink(), sourceDirectory, getBundle( locale ) );
 
             if ( listener != null )
             {
@@ -284,5 +285,10 @@
         // TODO: explicit output directory when it is back
         props.setProperty( "checkstyle.cache.file", getProject().getModel().getBuild().getDirectory() + "/checkstyle-cachefile" );
         return props;
+    }
+
+    private static ResourceBundle getBundle( Locale locale )
+    {
+        return ResourceBundle.getBundle("checkstyle-report", locale, CheckstyleReport.class.getClassLoader() );
     }
 }

Modified: maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListener.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListener.java?rev=193151&r1=193150&r2=193151&view=diff
==============================================================================
--- maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListener.java (original)
+++ maven/components/trunk/maven-reports/maven-checkstyle-plugin/src/main/java/org/apache/maven/plugin/checkstyle/CheckstyleReportListener.java Thu Jun 23 07:49:54 2005
@@ -19,6 +19,8 @@
 import org.codehaus.doxia.sink.Sink;
 import org.codehaus.plexus.util.StringUtils;
 
+import java.util.ResourceBundle;
+
 import com.puppycrawl.tools.checkstyle.api.AuditEvent;
 import com.puppycrawl.tools.checkstyle.api.AuditListener;
 import com.puppycrawl.tools.checkstyle.api.AutomaticBean;
@@ -32,8 +34,6 @@
     extends AutomaticBean
     implements AuditListener
 {
-    private static final String TITLE = "Checkstyle Results";
-
     private Sink sink;
 
     private String sourceDirectory;
@@ -42,17 +42,25 @@
 
     private boolean fileInitialized;
 
-    public CheckstyleReportListener( Sink sink, String sourceDirectory )
+    private ResourceBundle bundle;
+
+    public CheckstyleReportListener( Sink sink, String sourceDirectory, ResourceBundle bundle )
     {
         this.sink = sink;
         this.sourceDirectory = sourceDirectory;
+        this.bundle = bundle;
+    }
+
+    private String getTitle()
+    {
+        return bundle.getString( "report.checkstyle.title" );
     }
 
     public void auditStarted( AuditEvent event )
     {
         sink.head();
         sink.title();
-        sink.text( TITLE );
+        sink.text( getTitle() );
         sink.title_();
         sink.head_();
 
@@ -60,11 +68,11 @@
 
         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.checkstyle.checkstylelink" ) + " " );
         sink.link( "http://checkstyle.sourceforge.net/" );
         sink.text( "Checkstyle" );
         sink.link_();
@@ -74,7 +82,7 @@
 
         sink.section1_();
         sink.sectionTitle1();
-        sink.text( "Files" );
+        sink.text( bundle.getString( "report.checkstyle.files" ) );
         sink.sectionTitle1_();
 
         // TODO files summary
@@ -118,10 +126,10 @@
                 sink.table();
                 sink.tableRow();
                 sink.tableHeaderCell();
-                sink.text( "Violation" );
+                sink.text( bundle.getString( "report.checkstyle.column.violation" ) );
                 sink.tableHeaderCell_();
                 sink.tableHeaderCell();
-                sink.text( "Line" );
+                sink.text( bundle.getString( "report.checkstyle.column.line" ) );
                 sink.tableHeaderCell_();
                 sink.tableRow_();
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org