Change By: Dennis Lundberg (26/Oct/12 5:59 PM)
Description: {noformat}
Index: src/main/java/org/codehaus/mojo/l10n/PseudoLocalizeMojo.java
===================================================================
--- src/main/java/org/codehaus/mojo/l10n/PseudoLocalizeMojo.java        (Revision 17709)
+++ src/main/java/org/codehaus/mojo/l10n/PseudoLocalizeMojo.java        (Arbeitskopie)
@@ -67,6 +67,13 @@
     private File outputDirectory;
 
     /**
+     * Replace existing target file or only add missing properties.
+     * 
+     * @parameter default-value=true 
+     */
+    private boolean replaceOutput;
+    
+    /**
      * The input directory from which we copy the resources.
      * The plugin scans the build output directory by default, in order to have
      * the complete set of resources that end up in the product.
@@ -209,6 +216,18 @@
         BufferedInputStream in = null;
         BufferedOutputStream out = null;
         to.getParentFile().mkdirs();
+        
+        Properties toProps = new Properties();
+        if( to.exists() ) {
+          BufferedInputStream inStream = null;
+          try {
+            inStream = new BufferedInputStream( new FileInputStream( to ) );
+            toProps.load(inStream);
+          } finally {
+            IOUtil.close( inStream );
+          }
+        }
+        
         try
         {
             in = new BufferedInputStream( new FileInputStream( from ) );
@@ -219,7 +238,12 @@
                 String key = (String) it.next();
                 String val = props.getProperty( key );
                 String newVal = MessageFormat.format( pseudoLocPattern, new String[]{val} );
-                props.setProperty( key, newVal );
+                String toProperty = toProps.getProperty(key);
+                if( replaceOutput || toProperty == null ) {
+                  props.setProperty( key, newVal );
+                } else {
+                  props.setProperty( key, toProperty );
+                }
             }
             out = new BufferedOutputStream( new FileOutputStream( to ) );
             props.store( out, "Pseudo Localized bundle file for I18N testing autogenerated by the l10n-maven-plugin." );
{noformat}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to