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 2005/10/23 17:20:01 UTC

svn commit: r327801 - /maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java

Author: vsiveton
Date: Sun Oct 23 08:19:58 2005
New Revision: 327801

URL: http://svn.apache.org/viewcvs?rev=327801&view=rev
Log:
Corrected a regression bug due to MNG-1216 ie Locale.ENGLISH is the default language for bundles. Reallowed the following configuration <locales>en,...</locales> by correcting initLocalesList() method.

Modified:
    maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java

Modified: maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java?rev=327801&r1=327800&r2=327801&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/SiteMojo.java Sun Oct 23 08:19:58 2005
@@ -70,6 +70,9 @@
 
     private static final String DEFAULT_TEMPLATE = RESOURCE_DIR + "/maven-site.vm";
 
+    /** The locale by default for all default bundles */
+    private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
+
     /**
      * Directory containing source for apt, fml and xdoc docs.
      *
@@ -136,6 +139,8 @@
     private boolean addModules;
 
     /**
+     * Specifies the output encoding.
+     *
      * @parameter expression="${outputEncoding}"
      * default-value="ISO-8859-1"
      */
@@ -239,7 +244,7 @@
             List localesList = initLocalesList();
             if ( localesList.isEmpty() )
             {
-                localesList = Collections.singletonList( Locale.ENGLISH );
+                localesList = Collections.singletonList( DEFAULT_LOCALE );
             }
 
             // Default is first in the list
@@ -456,6 +461,8 @@
      * Init the <code>localesList</code> variable.
      * <p>If <code>locales</code> variable is available, the first valid token will be the <code>defaultLocale</code>
      * for this instance of the Java Virtual Machine.</p>
+     *
+     * @return a list of <code>Locale</code>
      */
     private List initLocalesList()
     {
@@ -480,23 +487,27 @@
                     continue;
                 }
 
-                if ( !i18n.getBundle( "site-plugin", locale ).getLocale().getLanguage().equals( locale.getLanguage() ) )
+                // Default bundles are in English
+                if ( !locale.getLanguage().equals( DEFAULT_LOCALE.getLanguage() ) )
                 {
-                    StringBuffer sb = new StringBuffer();
+                    if ( !i18n.getBundle( "site-plugin", locale ).getLocale().getLanguage().equals( locale.getLanguage() ) )
+                    {
+                        StringBuffer sb = new StringBuffer();
 
-                    sb.append( "The locale '" ).append( locale ).append( "' (" );
-                    sb.append( locale.getDisplayName( Locale.ENGLISH ) );
-                    sb.append( ") is not currently support by Maven - IGNORING. " );
-                    sb.append( "\n" );
-                    sb.append( "Contribution are welcome and greatly appreciated! " );
-                    sb.append( "\n" );
-                    sb.append( "If you want to contribute a new translation, please visit " );
-                    sb.append( "http://maven.apache.org/maven2/plugins/maven-site-plugin/i18n.html " );
-                    sb.append( "for detailed instructions." );
+                        sb.append( "The locale '" ).append( locale ).append( "' (" );
+                        sb.append( locale.getDisplayName( Locale.ENGLISH ) );
+                        sb.append( ") is not currently support by Maven - IGNORING. " );
+                        sb.append( "\n" );
+                        sb.append( "Contribution are welcome and greatly appreciated! " );
+                        sb.append( "\n" );
+                        sb.append( "If you want to contribute a new translation, please visit " );
+                        sb.append( "http://maven.apache.org/plugins/maven-site-plugin/i18n.html " );
+                        sb.append( "for detailed instructions." );
 
-                    getLog().warn( sb.toString() );
+                        getLog().warn( sb.toString() );
 
-                    continue;
+                        continue;
+                    }
                 }
 
                 localesList.add( locale );