[Lutinutil-commits] r1060 - in trunk/maven-i18n-plugin: . src/main/java/org/codelutin/i18n/plugin src/main/java/org/codelutin/i18n/plugin/core src/main/java/org/codelutin/i18n/plugin/extension src/main/java/org/codelutin/i18n/plugin/ui
Author: tchemit Date: 2008-08-24 09:16:36 +0000 (Sun, 24 Aug 2008) New Revision: 1060 Added: trunk/maven-i18n-plugin/THIRD-PARTY.txt Modified: trunk/maven-i18n-plugin/pom.xml trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/PluginHelper.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Generate.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Getter.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Parser.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java Log: correction du bug suite au passage utf8. creation release 0.5 qui fonctionne tres bien en utf8 et qui utilise lutinproject:2.4 Added: trunk/maven-i18n-plugin/THIRD-PARTY.txt =================================================================== --- trunk/maven-i18n-plugin/THIRD-PARTY.txt (rev 0) +++ trunk/maven-i18n-plugin/THIRD-PARTY.txt 2008-08-24 09:16:36 UTC (rev 1060) @@ -0,0 +1,33 @@ +List of third-party dependencies grouped by their license type. + +Common Public License Version 1.0 : + * JUnit (junit:junit:3.8.1 - http://junit.org) + +GPL : + * Lutin file processor (lutinlib:lutinprocessor:0.12 - http://labs.libre-entreprise.org/projects/lutinprocessor/lutinprocessor) + +LGPL : + * Lutin plugin utilities library (org.codelutin:lutinpluginutil:0.1 - http://labs.libre-entreprise.org/projects/lutinutil) + +The Apache Software License, Version 2.0 : + * Commons Logging (commons-logging:commons-logging:1.1.1 - http://commons.apache.org/logging) + * Logging (commons-logging:commons-logging:1.1 - http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/) + * Maven Artifact (org.apache.maven:maven-artifact:2.0.4 - http://maven.apache.org/maven-artifact) + * Maven Artifact Manager (org.apache.maven:maven-artifact-manager:2.0.4 - http://maven.apache.org/maven-artifact-manager) + * Maven Local Settings Model (org.apache.maven:maven-settings:2.0.4 - http://maven.apache.org/maven-settings) + * Maven Model (org.apache.maven:maven-model:2.0.4 - http://maven.apache.org/maven-model) + * Maven Plugin API (org.apache.maven:maven-plugin-api:2.0.4 - http://maven.apache.org/maven-plugin-api) + * Maven Profile Model (org.apache.maven:maven-profile:2.0.4 - http://maven.apache.org/maven-profile) + * Maven Project Builder (org.apache.maven:maven-project:2.0.4 - http://maven.apache.org/maven-project) + * Maven Repository Metadata Model (org.apache.maven:maven-repository-metadata:2.0.4 - http://maven.apache.org/maven-repository-metadata) + * Maven Wagon API (org.apache.maven.wagon:wagon-provider-api:1.0-alpha-6 - no url defined) + * Unnamed - ant:ant:jar:1.6.5 (ant:ant:1.6.5 - http://www.apache.org/ant) + * XML Commons External Components XML APIs (xml-apis:xml-apis:1.0.b2 - http://xml.apache.org/commons/#external) + +Unknown license : + * Default Plexus Container (org.codehaus.plexus:plexus-container-default:1.0-alpha-9 - no url defined) + * Plexus Common Utilities (org.codehaus.plexus:plexus-utils:1.0.4 - no url defined) + * Plexus Common Utilities (org.codehaus.plexus:plexus-utils:1.1 - no url defined) + * Unnamed - commons-collections:commons-collections:jar:3.1 (commons-collections:commons-collections:3.1 - no url defined) + * Unnamed - xalan:xalan:jar:2.7.0 (xalan:xalan:2.7.0 - no url defined) + * classworlds (classworlds:classworlds:1.1-alpha-2 - http://classworlds.codehaus.org/) \ No newline at end of file Modified: trunk/maven-i18n-plugin/pom.xml =================================================================== --- trunk/maven-i18n-plugin/pom.xml 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/pom.xml 2008-08-24 09:16:36 UTC (rev 1060) @@ -66,7 +66,7 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> <name>Plugin maven pour lutini18n</name> - <version>0.4-SNAPSHOT</version> + <version>0.5</version> <description> Plugin pour maven 2 pour la génération des bundles pour l'internationnalisation des applications java fait par lutinutil-i18n Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/PluginHelper.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/PluginHelper.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/PluginHelper.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,28 +1,31 @@ /** * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ package org.codelutin.i18n.plugin; import java.io.File; +import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FilterOutputStream; import java.io.IOException; +import java.io.InputStreamReader; import java.io.OutputStream; +import java.io.OutputStreamWriter; import java.text.MessageFormat; import java.util.Collections; import java.util.Enumeration; @@ -157,14 +160,18 @@ * Permet d'avoir les fichiers de proprietes tries. * * @author julien + * @author chemit */ public static class I18nProperties extends Properties { private static final long serialVersionUID = -1147150444452577558L; + /** l'encoding a utiliser pour lire et ecrire le properties. */ + protected String encoding; - public I18nProperties() { + public I18nProperties(String encoding) { super(); + this.encoding = encoding; } public I18nProperties(Properties defaults) { @@ -188,9 +195,37 @@ return result.elements(); } - public void store(File bundleOut) throws IOException { - super.store(new PropertiesDateRemoveFilterStream(new FileOutputStream(bundleOut)), null); + /** + * Charge le properties a partir d'un fichier. + * + * @param src le fichier src a charger en utilisant l'encoding declare + * @return l'instance du properties + * @throws IOException if any io pb + */ + public I18nProperties load(File src) throws IOException { + super.load(new InputStreamReader(new FileInputStream(src), encoding)); + return this; } + + /** + * Sauvegarde le properties dans un fichier, sans commentaire et en utilisant l'encoding declare. + * + * @param dst the fichier de destination + * @throws IOException if any io pb + */ + public void store(File dst) throws IOException { + super.store(new OutputStreamWriter(new PropertiesDateRemoveFilterStream(new FileOutputStream(dst)), encoding), null); + } + + /** + * Sauvegarde le properties dans un fichier, sans commentaire en laissant java encode en unicode. + * + * @param dst le fichier de destination + * @throws IOException if any io pb + */ + public void store(OutputStream dst) throws IOException { + super.store(new PropertiesDateRemoveFilterStream(dst), null); + } } public static class PropertiesDateRemoveFilterStream extends FilterOutputStream { @@ -201,9 +236,7 @@ public PropertiesDateRemoveFilterStream(OutputStream out) { super(out); firstLineOver = false; - String lineSeparator = java.security.AccessController - .doPrivileged(new sun.security.action.GetPropertyAction( - "line.separator")); + String lineSeparator = System.getProperty("line.separator"); endChar = lineSeparator.charAt(lineSeparator.length() - 1); } Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nParser.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ package org.codelutin.i18n.plugin.core; @@ -20,20 +20,16 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codelutin.i18n.plugin.PluginHelper; +import org.codelutin.i18n.plugin.PluginHelper.I18nProperties; import org.codelutin.i18n.plugin.ui.KeysModifier; import org.codelutin.util.FileUpdater; import org.codelutin.util.FileUtil; -import java.io.BufferedOutputStream; import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Properties; /** * Abstract implementation for parsing goal. @@ -74,11 +70,11 @@ */ protected SourceEntry[] entries; - protected Properties result; + protected I18nProperties result; - protected Properties oldParser; + protected I18nProperties oldParser; - protected Properties oldLanguage; + protected I18nProperties oldLanguage; protected int fileTreated = 0; protected long t0; @@ -91,9 +87,9 @@ public void init() { t0 = System.nanoTime(); - result = new Properties(); - oldParser = new Properties(); - oldLanguage = new Properties(); + result = new I18nProperties(encoding); + oldParser = new I18nProperties(encoding); + oldLanguage = new I18nProperties(encoding); out.mkdirs(); // evenements if (keysModifier) { @@ -111,6 +107,7 @@ * * @param file the file path to test * @return <code>true</code> if file is up to date and do not need to be parsed + * @see FileUpdater */ protected final boolean isFileUptodate(File file) { return updater != null && updater.isFileUpToDate(file); @@ -130,28 +127,17 @@ try { // Reprise sur un ancien parsing File oldParserFile = PluginHelper.getGetterFile(out, getOutGetter(), true); - //File oldParserFile = new File(out.getAbsolutePath() + File.separatorChar + getOutGetter()); File saveFile = PluginHelper.getGetterFileBackup(out, getOutGetter()); - //File saveFile = new File(out.getAbsolutePath() + File.separatorChar + getOutGetter() + "~"); - /*if (!oldParserFile.exists()) { - oldParserFile.getParentFile().mkdirs(); - } - oldParserFile.createNewFile();*/ - - oldParser.load(new FileInputStream(oldParserFile)); - + oldParser.load(oldParserFile); FileUtil.copy(oldParserFile, saveFile); // Anciennes cles disponnibles + //fixme : pourquoi on utilise un bundle precis ? le premier ici, je ne comprends pas File oldLanguageFile = PluginHelper.getI18nFile(src, artifactId, bundles[0], true); - //File oldLanguageFile = new File(src.getAbsolutePath() + File.separatorChar + artifactId + "-" + bundles[0] + ".properties"); - /*if (!oldLanguageFile.exists()) { - oldLanguageFile.getParentFile().mkdirs(); - } - oldLanguageFile.createNewFile();*/ - oldLanguage.load(new FileInputStream(oldLanguageFile)); + oldLanguage.load(oldLanguageFile); + // Parsing parse(); @@ -168,6 +154,11 @@ } + /** + * launch the parse on every given entries. + * + * @throws IOException if any io pb + */ public void parse() throws IOException { if (treateDefaultEntry) { addDefaultEntry(); @@ -199,10 +190,21 @@ } } + /** + * Obtain all the relative path of files to treate for a given entry. + * + * @param entry the given entry + * @return the list of relative path of files for the given entry + */ protected String[] getFilesForEntry(SourceEntry entry) { return entry.getIncludedFiles(getDefaultBasedir(), getDefaultIncludes(), getDefaultExcludes()); } + /** + * Add the default entry to entries given in configuration. + * <p/> + * This is a convinient method to simplify the configuration of the plugin. + */ protected void addDefaultEntry() { List<SourceEntry> list; @@ -215,6 +217,13 @@ entries = list.toArray(new SourceEntry[list.size()]); } + /** + * launch parsing on a given entry. + * + * @param basedir the basedir of the entry + * @param files the relative path of files to be treated for the entry. + * @throws IOException if any io pb. + */ protected void parseEntry(File basedir, String[] files) throws IOException { long t00 = System.nanoTime(); for (int i = 0; i < files.length; i++) { @@ -235,7 +244,7 @@ // Detection de nouvelles cles, sauvegarde du fichier pour pouvoir le restaurer en cas de plantage if (size != result.size()) { - saveProperties0(); + saveGetterFile(); } if (touchFile) { if (verbose) { @@ -252,16 +261,13 @@ } } - protected void saveProperties0() throws IOException { - OutputStream outputStream = null; - try { - outputStream = new BufferedOutputStream(new FileOutputStream(PluginHelper.getGetterFile(out, getOutGetter(), false))); - //outputStream = new BufferedOutputStream(new FileOutputStream(out.getAbsolutePath() + File.separatorChar + getOutGetter())); - result.store(outputStream, null); - } finally { - if (outputStream != null) { - outputStream.close(); - } - } + /** + * Save the result in the getter file. + * + * @throws IOException if any io pb + */ + protected void saveGetterFile() throws IOException { + File getterFile = PluginHelper.getGetterFile(out, getOutGetter(), false); + result.store(getterFile); } } Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ @@ -20,15 +20,10 @@ import org.apache.maven.plugin.AbstractMojo; import org.codelutin.i18n.plugin.PluginHelper; -import org.codelutin.i18n.plugin.PluginHelper.I18nProperties; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.Properties; /** * Classe permettant d'obenir les parametres pendant les différentes phases @@ -55,21 +50,37 @@ protected File src; /** - * Met les fichiers generes dans le repertoire des sources i18n. + * Repertoire des fichiers generes i18n. * - * @parameter expression="${i18n.genSrc}" default-value="true" + * @parameter expression="${i18n.out}" default-value="${basedir}/target/gen/i18n" + * @required */ - protected boolean genSrc; + protected File out; /** - * Repertoire des fichiers generes i18n. + * Nom du projet. * - * @parameter expression="${i18n.out}" default-value="${basedir}/target/gen/i18n" + * @parameter expression="${i18n.artifactId}" default-value="${project.artifactId}" + * @readonly + */ + protected String artifactId; + + /** + * encoding a utiliser pour charger et sauver les bundles + * + * @parameter expression="${i18n.encoding}" default-value="${maven.compile.encoding}" * @required */ - protected File out; + protected String encoding; /** + * Met les fichiers generes dans le repertoire des sources i18n. + * + * @parameter expression="${i18n.genSrc}" default-value="true" + */ + protected boolean genSrc; + + /** * Active la modification de cle * * @parameter expression="${i18n.keysModifier}" default-value="false" @@ -84,14 +95,6 @@ protected boolean verbose; /** - * Nom du projet. - * - * @parameter expression="${i18n.artifactId}" default-value="${project.artifactId}" - * @readonly - */ - protected String artifactId; - - /** * conserve les anciens fichiers de traduction avec un suffix ~ * * @parameter expression="${i18n.keepBackup}" default-value="true" @@ -106,14 +109,6 @@ protected boolean strictMode; /** - * encoding a utiliser pour charger et sauver les bundles - * - * @parameter expression="${i18n.encoding}" default-value="${maven.compile.encoding}" - * @required - */ - protected String encoding; - - /** * Répertoire de stockage des fichiers i18n pour la recuperation des fichiers * de traduction entre librairie */ @@ -141,24 +136,6 @@ } /** - * Concatène deux fichiers de proprietes - * - * @param in le fichier entrant - * @param out le fichier sortant - * @throws FileNotFoundException si fichier non trouvé - * @throws IOException si problème pendant la sauvegarde - */ - protected void concactProperties(File in, File out) throws IOException { - Properties propertiesIn = new I18nProperties(); - propertiesIn.load(new FileInputStream(in)); - - I18nProperties propertiesOut = new I18nProperties(); - propertiesOut.load(new FileInputStream(out)); - propertiesOut.putAll(propertiesIn); - propertiesOut.store(out); - } - - /** * Construit une chaine de log formatée. * * @param msg le prefix du message Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Generate.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Generate.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Generate.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ @@ -25,9 +25,8 @@ import org.codelutin.util.FileUtil; import java.io.File; -import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; -import java.util.Properties; /** * Merge des fichiers de propriétés avec les anciens. @@ -47,23 +46,20 @@ for (String bundle : bundles) { try { // Merge - //File bundleSrc = new File(src.getAbsolutePath() + File.separatorChar + artifactId + "-" + bundle + ".properties"); - //File bundleOut = new File(out.getAbsolutePath() + File.separatorChar + artifactId + "-" + bundle + ".properties"); File bundleSrc = PluginHelper.getI18nFile(src, artifactId, bundle, false); File bundleOut = PluginHelper.getI18nFile(out, artifactId, bundle, false); if (bundleSrc.exists()) { - Properties propertiesSrc = new Properties(); - propertiesSrc.load(new FileInputStream(bundleSrc)); + I18nProperties propertiesSrc = new I18nProperties(encoding).load(bundleSrc); - I18nProperties propertiesOut = new I18nProperties(); + I18nProperties propertiesOut = new I18nProperties(encoding); if (!strictMode) { // push back in bundle out, all the bundle src keys propertiesOut.putAll(propertiesSrc); } - propertiesOut.load(new FileInputStream(bundleOut)); + propertiesOut.load(bundleOut); // Parcours des clés for (Object key : propertiesOut.keySet()) { @@ -82,14 +78,13 @@ } } - //saveBundle(bundleOut, propertiesOut); + //fixme : on devrait laisser le fichier en utf8 ? + //propertiesOut.store(bundleOut); + propertiesOut.store(new FileOutputStream(bundleOut)); - propertiesOut.store(bundleOut); - // Sauvegarde avant copie if (genSrc && keepBackup) { FileUtil.copy(bundleSrc, PluginHelper.getI18nFileBackup(src, artifactId, bundle)); - //FileUtil.copy(bundleSrc, new File(src.getAbsolutePath() + File.separatorChar + artifactId + "-" + bundle + ".properties" + "~")); } getLog().info("Merge bundle " + bundleSrc.getAbsolutePath()); @@ -108,9 +103,4 @@ } } - /*void saveBundle(File bundleOut, Properties propertiesBundle) throws IOException { - FileOutputStream fileOutputStream = new FileOutputStream(bundleOut); - PropertiesDateRemoveFilterStream filter = new PropertiesDateRemoveFilterStream(fileOutputStream); - propertiesBundle.store(filter, null); - }*/ } Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Getter.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Getter.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Getter.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ @@ -22,13 +22,15 @@ import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.util.DirectoryScanner; import org.codelutin.i18n.plugin.PluginHelper; +import org.codelutin.i18n.plugin.PluginHelper.I18nProperties; import org.codelutin.util.FileUtil; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; /** - * Récupère les différents fichiers des parsers en un fichier de propriétés. + * Recupere les différents fichiers des parsers en un fichier de proprietes. * * @author julien * @goal get @@ -54,7 +56,6 @@ // Fusion des fichiers propriétés des différents parsers for (String file : files) { File bundleGetter = PluginHelper.getGetterFile(out, file, false); - //File bundleGetter = new File(out.getAbsolutePath() + File.separatorChar + file); concactProperties(bundleGetter, bundleGetters); if (genSrc) { bundleGetter.delete(); @@ -64,7 +65,6 @@ // Création des bundles for (String bundle : bundles) { - //File bundleOut = new File(out.getAbsolutePath() + File.separatorChar + artifactId + "-" + bundle + ".properties"); File bundleOut = PluginHelper.getI18nFile(out, artifactId, bundle, false); FileUtil.copy(bundleGetters, bundleOut); getLog().info("Generate bundle " + bundleOut.getAbsolutePath()); @@ -76,4 +76,20 @@ throw new MojoFailureException("File Error I/O"); } } + + /** + * Concatene deux fichiers de proprietes + * + * @param in le fichier entrant + * @param out le fichier sortant + * @throws FileNotFoundException si fichier non trouvé + * @throws IOException si problème pendant la sauvegarde + */ + protected void concactProperties(File in, File out) throws IOException { + I18nProperties propertiesIn = new I18nProperties(encoding).load(in); + + I18nProperties propertiesOut = new I18nProperties(encoding).load(out); + propertiesOut.putAll(propertiesIn); + propertiesOut.store(out); + } } Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Parser.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Parser.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/Parser.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ @@ -30,7 +30,11 @@ */ public interface Parser { - /** Lancement du parser */ + /** + * Lancement du parser + * + * @throws java.io.IOException if any io pb + */ public void parse() throws IOException; /** Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserEvent.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/ParserException.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/core/SourceEntry.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ package org.codelutin.i18n.plugin.core; Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJava.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaActionConfig.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ package org.codelutin.i18n.plugin.extension; Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJavaTabConfig.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /** * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserJaxx.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserSwixat.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/extension/ParserXml.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ @@ -102,9 +102,7 @@ // Détection de nouvelles clés, sauvegarde du fichier pour pouvoir le restaurer en cas de plantage if (size != result.size()) { - saveProperties0(); - //OutputStream xmlparserOut = new FileOutputStream(out.getAbsolutePath() + File.separatorChar + getOutGetter()); - //result.store(xmlparserOut, null); + saveGetterFile(); } } catch (Exception e) { throw new ParserException(e); Modified: trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java =================================================================== --- trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java 2008-08-24 08:02:04 UTC (rev 1059) +++ trunk/maven-i18n-plugin/src/main/java/org/codelutin/i18n/plugin/ui/KeysModifier.java 2008-08-24 09:16:36 UTC (rev 1060) @@ -1,18 +1,18 @@ /* * *##% Plugin maven pour lutini18n * Copyright (C) 2007 - 2008 CodeLutin - * + * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public + * + * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%* */ @@ -31,8 +31,8 @@ import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -151,7 +151,7 @@ */ public void eventNextFile(File file) { if (needModifiedFile) { - String content = ""; + String content; int region = 0; try { @@ -214,31 +214,13 @@ } /** Action sur la fermeture de la frame */ - class EventWindows implements WindowListener { + class EventWindows extends WindowAdapter { - public void windowClosed(WindowEvent e) { - } - - public void windowActivated(WindowEvent e) { - } - + @Override public void windowClosing(WindowEvent e) { setVisible(false); eventNextKey(); } - - public void windowDeactivated(WindowEvent e) { - } - - public void windowDeiconified(WindowEvent e) { - } - - public void windowIconified(WindowEvent e) { - } - - public void windowOpened(WindowEvent e) { - } - } /** Permet de passer à la clé suivante */
participants (1)
-
tchemit@users.labs.libre-entreprise.org