Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserException.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserException.java:1.1 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserException.java:1.2 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserException.java:1.1 Tue Oct 30 11:55:14 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserException.java Fri Nov 2 16:06:37 2007 @@ -1,5 +1,30 @@ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package org.codelutin.i18n.plugin.core; +/** + * Permet la gestion des exceptions dans les parsers et dans les événements + * + * @author julien + * + */ public class ParserException extends RuntimeException { private static final long serialVersionUID = 1L; Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Generate.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Generate.java:1.4 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Generate.java:1.5 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Generate.java:1.4 Fri Nov 2 15:02:59 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Generate.java Fri Nov 2 16:06:37 2007 @@ -1,3 +1,22 @@ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package org.codelutin.i18n.plugin.core; @@ -18,6 +37,8 @@ import org.codelutin.util.FileUtil; /** + * Permet de générer les fichiers de traduction avec les fichiers de traducton + * des librairies et * * @author julien * @@ -52,33 +73,33 @@ * @see org.apache.maven.plugin.AbstractMojo#execute() */ public void execute() throws MojoExecutionException, MojoFailureException { - if(gen) { - // Récupére les libs seulement si le plugin est lancé après la phase de compilation - Set artifacts = project.getArtifacts(); - - try { - for (String bundle : bundles) { - File bundleOut = new File(out.getAbsolutePath() + File.separatorChar + "language-" + bundle + ".properties"); - - for (Artifact artifact : artifacts) { - File libBundle = extract(artifact.getFile().getAbsolutePath(), "language-" + bundle + ".properties"); - - if(libBundle != null) { - concactProperties(libBundle, bundleOut); - log.info("Processing library " + libBundle.getAbsolutePath()); - libBundle.delete(); - } + // Récupére les libs seulement si le plugin est lancé après la phase de compilation + Set artifacts = project.getArtifacts(); + + try { + for (String bundle : bundles) { + File bundleOut = new File(out.getAbsolutePath() + File.separatorChar + "language-" + bundle + ".properties"); + + // Récupération dans les libs les fichiers de traduction + for (Artifact artifact : artifacts) { + File libBundle = extract(artifact.getFile().getAbsolutePath(), "language-" + bundle + ".properties"); + + if(libBundle != null) { + concactProperties(libBundle, bundleOut); + log.info("Processing library " + libBundle.getAbsolutePath()); + libBundle.delete(); } + } - File bundleJava = new File(outJava.getAbsolutePath() + File.separatorChar + "language-" + bundle + ".properties"); - FileUtil.copy(bundleOut, bundleJava); + // Copie dans le répertoire de compilation des fichiers de traduction + File bundleJava = new File(outJava.getAbsolutePath() + File.separatorChar + "language-" + bundle + ".properties"); + FileUtil.copy(bundleOut, bundleJava); - log.info("Generate bundle " + bundleJava.getAbsolutePath()); - } - } catch (Exception e) { - log.error("Generate Error I/O ", e); - throw new MojoFailureException("Generate Error I/O "); - } + log.info("Generate bundle " + bundleJava.getAbsolutePath()); + } + } catch (Exception e) { + log.error("Generate Error I/O ", e); + throw new MojoFailureException("Generate Error I/O "); } } Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Parser.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Parser.java:1.3 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Parser.java:1.4 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Parser.java:1.3 Fri Nov 2 10:28:07 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Parser.java Fri Nov 2 16:06:37 2007 @@ -1,3 +1,22 @@ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package org.codelutin.i18n.plugin.core; import java.io.File; Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Merge.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Merge.java:1.3 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Merge.java:1.4 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Merge.java:1.3 Fri Nov 2 15:02:59 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Merge.java Fri Nov 2 16:06:37 2007 @@ -1,3 +1,22 @@ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package org.codelutin.i18n.plugin.core; import java.io.File; @@ -53,10 +72,12 @@ Properties propertiesBundle = new SortedProperties(); propertiesBundle.load(new FileInputStream(bundleOut)); + // Parcours des clés for (Object key : propertiesBundle.keySet()) { Object oldKey = propertiesBundle.get(key); Object value = propertiesSrc.get(oldKey); + // Récupération de la clé si elle a été renommé if(!key.equals(oldKey) && value == null) { value = propertiesSrc.get(key); } @@ -79,6 +100,7 @@ } if(genSrc) { + // Copie des fichiers dans les sources FileUtil.copy(bundleOut, bundleSrc); log.info("Copy bundle " + bundleSrc.getAbsolutePath()); } Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserEvent.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserEvent.java:1.2 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserEvent.java:1.3 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserEvent.java:1.2 Fri Nov 2 10:28:07 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/ParserEvent.java Fri Nov 2 16:06:37 2007 @@ -1,13 +1,56 @@ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package org.codelutin.i18n.plugin.core; import java.io.File; +/** + * Permet d'ajouter des événements sur les parsers + * + * @author julien + * + */ public interface ParserEvent { + /** + * Méthode appelée quand on change de fichier parsé + * @param file + */ public void eventChangeFile(File file); + + /** + * Méthode appelée après le parsing du fichier + * @param file + */ public void eventNextFile(File file); + /** + * Méthode appelée quand on change de clé + * @param keyI18n + */ public void eventChangeKey(String keyI18n); + + /** + * Méthode appelée pour récupérer la nouvelle valeur de clé + * @return + */ public String eventGetRealKey(); } Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Getter.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Getter.java:1.3 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Getter.java:1.4 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Getter.java:1.3 Mon Oct 29 17:29:39 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/Getter.java Fri Nov 2 16:06:37 2007 @@ -9,13 +9,32 @@ import org.codelutin.util.FileUtil; /** - * Récupère les différents fichiers des parseurs en un fichier de propriétés. + * Récupère les différents fichiers des parsers en un fichier de propriétés. * * @author julien * * @goal get * @phase compile */ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + public class Getter extends AbstractI18nPlugin { /* @@ -33,7 +52,7 @@ ds.scan(); String[] files = ds.getIncludedFiles(); - // Fusion des fichiers propriétés des différents parseurs + // Fusion des fichiers propriétés des différents parsers for (int i = 0; i < files.length; i++) { File bundleGetter = new File(out.getAbsolutePath() + File.separatorChar + files[i]); concactProperties(bundleGetter, bundleGetters); Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java diff -u maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java:1.6 maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java:1.7 --- maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java:1.6 Fri Nov 2 15:02:59 2007 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/core/AbstractI18nPlugin.java Fri Nov 2 16:06:37 2007 @@ -1,3 +1,22 @@ +/* *##% + * Copyright (C) 2007 + * I18nPlugin, Code Lutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + package org.codelutin.i18n.plugin.core; import java.io.File; @@ -49,12 +68,6 @@ protected File out; /** - * @description Récupère les fichiers de propriètés dans les dépendances du projet et génére le fichiers de propriété. - * @parameter expression="${i18n.gen}" default-value="true" - */ - protected boolean gen; - - /** * @description Active la modification de clé * @parameter expression="${i18n.keysModifier}" default-value="true" */