Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserXml.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserXml.java:1.7 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserXml.java:1.8 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserXml.java:1.7 Wed Nov 7 10:22:22 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserXml.java Thu Nov 8 14:33:41 2007 @@ -64,7 +64,8 @@ protected XPath xpath; protected Properties result; - protected Properties oldProperties; + protected Properties oldParser; + protected Properties oldLanguage; /** * Initialisation des paramètres du parser @@ -88,20 +89,25 @@ this.rules = getRules(fileRules); this.xpath = factory.newXPath(); this.result = new Properties(); - this.oldProperties = new Properties(); - + this.oldParser = new Properties(); + this.oldLanguage = new Properties(); out.mkdirs(); try { // Reprise sur un ancien parsing - File oldFile = new File(out.getAbsolutePath() + File.separatorChar + outGetter); - oldFile.createNewFile(); - oldProperties.load(new FileInputStream(oldFile)); + File oldParserFile = new File(out.getAbsolutePath() + File.separatorChar + outGetter); + oldParserFile.createNewFile(); + oldParser.load(new FileInputStream(oldParserFile)); File saveFile = new File(out.getAbsolutePath() + File.separatorChar + outGetter + "~"); - FileUtil.copy(oldFile, saveFile); + FileUtil.copy(oldParserFile, saveFile); + // Anciennes clés disponnibles + File oldLanguageFile = new File(src.getAbsolutePath() + File.separatorChar + "language-" + bundles[0] + ".properties"); + oldLanguageFile.createNewFile(); + oldLanguage.load(new FileInputStream(oldLanguageFile)); + // Parsing parse(); @@ -181,12 +187,12 @@ if(key != null) { String keyModified = key; for (ParserEvent event : events) { - event.eventChangeKey(key); + event.eventChangeKey(key, !oldLanguage.containsKey(key)); keyModified = event.eventGetRealKey(); } - if(oldProperties.containsKey(key)) { - result.put(keyModified, oldProperties.get(key)); + if(oldParser.containsKey(key)) { + result.put(keyModified, oldParser.get(key)); } else { result.put(keyModified, key); } Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserJava.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserJava.java:1.7 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserJava.java:1.8 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserJava.java:1.7 Wed Nov 7 10:22:22 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserJava.java Thu Nov 8 14:33:41 2007 @@ -62,8 +62,9 @@ protected I18nFilter filter; protected Properties result; - protected Properties oldProperties; - + protected Properties oldParser; + protected Properties oldLanguage; + /* * (non-Javadoc) * @see org.apache.maven.plugin.AbstractMojo#execute() @@ -71,8 +72,9 @@ public void execute() throws MojoExecutionException, MojoFailureException { this.result = new Properties(); this.filter = new I18nFilter(); - this.oldProperties = new Properties(); - + this.oldParser = new Properties(); + this.oldLanguage = new Properties(); + // Événements if(keysModifier) { addParserEvent(new KeysModifier("_\\(\\s*\"", "\"\\s*(\\)|,|\\+|$)")); @@ -82,12 +84,17 @@ try { // Reprise sur un ancien parsing - File oldFile = new File(out.getAbsolutePath() + File.separatorChar + "java.getter"); - oldFile.createNewFile(); - oldProperties.load(new FileInputStream(oldFile)); + File oldParserFile = new File(out.getAbsolutePath() + File.separatorChar + "java.getter"); + oldParserFile.createNewFile(); + oldParser.load(new FileInputStream(oldParserFile)); File saveFile = new File(out.getAbsolutePath() + File.separatorChar + "java.getter~"); - FileUtil.copy(oldFile, saveFile); + FileUtil.copy(oldParserFile, saveFile); + + // Anciennes clés disponnibles + File oldLanguageFile = new File(src.getAbsolutePath() + File.separatorChar + "language-" + bundles[0] + ".properties"); + oldLanguageFile.createNewFile(); + oldLanguage.load(new FileInputStream(oldLanguageFile)); // Parsing parse(); @@ -166,12 +173,12 @@ String key = keys[i]; String keyModified = key; for (ParserEvent event : events) { - event.eventChangeKey(key); + event.eventChangeKey(key, !oldLanguage.containsKey(key)); keyModified = event.eventGetRealKey(); } - if(oldProperties.containsKey(key)) { - result.put(keyModified, oldProperties.get(key)); + if(oldParser.containsKey(key)) { + result.put(keyModified, oldParser.get(key)); } else { result.put(keyModified, key); }