You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/07/15 11:29:17 UTC

svn commit: r1361669 - in /maven/release/trunk/maven-release-manager/src/main: java/org/apache/maven/shared/release/phase/MapVersionsPhase.java resources/release-messages.properties resources/release-messages_en.properties

Author: rfscholte
Date: Sun Jul 15 09:29:16 2012
New Revision: 1361669

URL: http://svn.apache.org/viewvc?rev=1361669&view=rev
Log:
MRELEASE-564: I18N support, now only for MapVersions and English

Added:
    maven/release/trunk/maven-release-manager/src/main/resources/release-messages.properties
    maven/release/trunk/maven-release-manager/src/main/resources/release-messages_en.properties
Modified:
    maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java

Modified: maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java?rev=1361669&r1=1361668&r2=1361669&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java (original)
+++ maven/release/trunk/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/MapVersionsPhase.java Sun Jul 15 09:29:16 2012
@@ -19,7 +19,10 @@ package org.apache.maven.shared.release.
  * under the License.
  */
 
+import java.text.MessageFormat;
 import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
 
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.project.MavenProject;
@@ -42,6 +45,8 @@ import org.codehaus.plexus.components.in
 public class MapVersionsPhase
     extends AbstractReleasePhase
 {
+    private ResourceBundle resourceBundle = ResourceBundle.getBundle( "release-messages", Locale.ENGLISH, MapVersionsPhase.class.getClassLoader() );
+    
     /**
      * Whether to convert to a snapshot or a release.
      */
@@ -262,9 +267,10 @@ public class MapVersionsPhase
                             
                             if ( !releaseVersionIsExplicit && releaseDescriptor.isInteractive() )
                             {
-                                nextVersion = prompter.prompt(
-                                    "What is the branch version for \"" + project.getName() + "\"? (" + projectId + ")",
-                                    suggestedVersion );
+                                String message =
+                                    MessageFormat.format( resourceBundle.getString( "mapversion.prompt.branch" ),
+                                                          project.getName(), projectId );
+                                nextVersion = prompter.prompt( message, suggestedVersion );
                             }
                             else
                             {
@@ -287,9 +293,10 @@ public class MapVersionsPhase
                             
                             if ( releaseDescriptor.isInteractive() && !nextSnapshotVersionIsExplicit )
                             {
-                                nextVersion =
-                                    prompter.prompt( "What is the new working copy version for \"" + project.getName()
-                                        + "\"? (" + projectId + ")", suggestedVersion );
+                                String message =
+                                    MessageFormat.format( resourceBundle.getString( "mapversion.prompt.workingcopy" ),
+                                                          project.getName(), projectId );
+                                nextVersion = prompter.prompt( message, suggestedVersion );
                             }
                             else
                             {
@@ -310,9 +317,10 @@ public class MapVersionsPhase
                         
                         if ( releaseDescriptor.isInteractive()  && !nextSnapshotVersionIsExplicit )
                         {
-                            nextVersion =
-                                prompter.prompt( "What is the new development version for \"" + project.getName() + "\"? ("
-                                    + projectId + ")", suggestedVersion );
+                            String message =
+                                MessageFormat.format( resourceBundle.getString( "mapversion.prompt.development" ),
+                                                      project.getName(), projectId );
+                            nextVersion = prompter.prompt( message, suggestedVersion );
                         }
                         else
                         {
@@ -333,9 +341,10 @@ public class MapVersionsPhase
 
                     if ( releaseDescriptor.isInteractive() && !releaseVersionIsExplicit )
                     {
-                        nextVersion = prompter.prompt(
-                            "What is the release version for \"" + project.getName() + "\"? (" + projectId + ")",
-                            suggestedVersion );
+                        String message =
+                            MessageFormat.format( resourceBundle.getString( "mapversion.prompt.release" ),
+                                                  project.getName(), projectId );
+                        nextVersion = prompter.prompt( message, suggestedVersion );
                     }
                     else
                     {

Added: maven/release/trunk/maven-release-manager/src/main/resources/release-messages.properties
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/resources/release-messages.properties?rev=1361669&view=auto
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/resources/release-messages.properties (added)
+++ maven/release/trunk/maven-release-manager/src/main/resources/release-messages.properties Sun Jul 15 09:29:16 2012
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+mapversion.prompt.branch      = What is the branch version for "{0}"? ({1})
+mapversion.prompt.development = What is the new development version for "{0}"? ({1})
+mapversion.prompt.release     = What is the release version for "{0}"? ({1})
+mapversion.prompt.workingcopy = What is the new working copy version for "{0}"? ({1})

Added: maven/release/trunk/maven-release-manager/src/main/resources/release-messages_en.properties
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/main/resources/release-messages_en.properties?rev=1361669&view=auto
==============================================================================
--- maven/release/trunk/maven-release-manager/src/main/resources/release-messages_en.properties (added)
+++ maven/release/trunk/maven-release-manager/src/main/resources/release-messages_en.properties Sun Jul 15 09:29:16 2012
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# NOTE:
+# This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It
+# must be provided nevertheless such that a request for locale "en" will not errorneously pick up the bundle for the
+# JVM's default locale (which need not be "en"). See the method javadoc about
+#   ResourceBundle.getBundle(String, Locale, ClassLoader)
+# for a full description of the lookup strategy.