Index: maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserMultiJava.java diff -u /dev/null maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserMultiJava.java:1.1 --- /dev/null Wed Jan 2 02:21:27 2008 +++ maven-i18n-plugin/src/java/org/codelutin/i18n/plugin/extension/ParserMultiJava.java Wed Jan 2 02:21:22 2008 @@ -0,0 +1,90 @@ +/* *##% + * 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.extension; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.codelutin.i18n.I18nFilter; + +import java.io.File; +import java.util.Properties; + +/** + * Récupération des chaîne à traduire depuis plusieurs paths de fichiers java. + * + * @author chemit + * @goal parserMultiJava + * @phase compile + */ +public class ParserMultiJava extends ParserJava { + + /** + * @description Source java. + * @parameter expression="${i18n.multilSrcJava}" + * @required + */ + protected String multilSrcJava; + + /** + * @description Patern de recherche des fichiers java. + * @parameter expression="${i18n.multiPaternJava}" + * @required + */ + protected String multiPaternJava; + + protected File[] srcJavas; + + protected String[] paternJavas; + protected I18nFilter filter; + + protected Properties result; + protected Properties oldParser; + protected Properties oldLanguage; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + initMulti(); + super.execute(); + } + + @Override + public void parse() { + for (int i = 0; i < srcJavas.length; i++) { + srcJava = srcJavas[i]; + paternJava = paternJavas[i]; + log.info("Parser srcPath : "+srcJava+", pattern: "+paternJava); + super.parse(); + } + } + + protected void initMulti() throws MojoExecutionException { + String[] strings = multilSrcJava.split(","); + String[] strings2 = multiPaternJava.split(","); + if (strings.length != strings2.length) { + throw new MojoExecutionException("should have same number of src and pattern"); + } + srcJavas = new File[strings.length]; + paternJavas = new String[strings.length]; + for (int i = 0; i < strings.length; i++) { + srcJavas[i] = new File(strings[i]); + paternJavas[i] = strings2[i]; + } + } +} \ No newline at end of file