I18n-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 802 discussions
Author: tchemit
Date: 2011-01-20 08:25:14 +0100 (Thu, 20 Jan 2011)
New Revision: 1847
Url: http://nuiton.org/repositories/revision/i18n/1847
Log:
Evolution #1213: Updates to processor 1.1
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-01-19 22:03:16 UTC (rev 1846)
+++ trunk/pom.xml 2011-01-20 07:25:14 UTC (rev 1847)
@@ -187,7 +187,7 @@
<!-- pour un muli module on doit fixer le projectId -->
<projectId>i18n</projectId>
- <processorVersion>1.0.4</processorVersion>
+ <processorVersion>1.1-SNAPSHOT</processorVersion>
<!--Multilanguage maven-site -->
<locales>fr,en</locales>
1
0
19 Jan '11
Author: tchemit
Date: 2011-01-19 23:03:16 +0100 (Wed, 19 Jan 2011)
New Revision: 1846
Url: http://nuiton.org/repositories/revision/i18n/1846
Log:
add license header
Modified:
trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
Modified: trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
===================================================================
--- trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java 2011-01-19 22:02:10 UTC (rev 1845)
+++ trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java 2011-01-19 22:03:16 UTC (rev 1846)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * I18n :: Api
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2011 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
+ * 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
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package org.nuiton.i18n;
import org.junit.AfterClass;
1
0
19 Jan '11
Author: tchemit
Date: 2011-01-19 23:02:10 +0100 (Wed, 19 Jan 2011)
New Revision: 1845
Url: http://nuiton.org/repositories/revision/i18n/1845
Log:
fix svn-keywords
Modified:
trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
Property changes on: trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
1
0
r1844 - in trunk/nuiton-i18n/src: main/java/org/nuiton/i18n main/java/org/nuiton/i18n/bundle main/java/org/nuiton/i18n/init main/java/org/nuiton/util test/java/org/nuiton/i18n test/java/org/nuiton/util test/java/org/nuiton/util/converter test/resources/META-INF
by tchemit@users.nuiton.org 19 Jan '11
by tchemit@users.nuiton.org 19 Jan '11
19 Jan '11
Author: tchemit
Date: 2011-01-19 22:38:53 +0100 (Wed, 19 Jan 2011)
New Revision: 1844
Url: http://nuiton.org/repositories/revision/i18n/1844
Log:
Evolution #1210: Remove deprecated api
Evolution #1208: Be able to force locale for translation (add some tests)
Added:
trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
trunk/nuiton-i18n/src/test/java/org/nuiton/util/converter/
trunk/nuiton-i18n/src/test/java/org/nuiton/util/converter/LocaleConverterTest.java
Removed:
trunk/nuiton-i18n/src/main/java/org/nuiton/util/LocaleConverter.java
trunk/nuiton-i18n/src/test/java/org/nuiton/util/LocaleConverterTest.java
Modified:
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nFilter.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/bundle/I18nBundleUtil.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/ClassPathI18nInitializer.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/DefaultI18nInitializer.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/UserI18nInitializer.java
trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nStoreTest.java
trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_en_GB.properties
trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_fr_FR.properties
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -128,12 +128,13 @@
}
/**
- * Retourne la chaine traduite si possible.
+ * Retourne la chaine traduite si possible dans la locale demandée.
*
* @param locale la locale dans lequel on souhaite la traduction
* @param message la chaine a traduire
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
+ * @since 2.1
*/
public static String l_(Locale locale, String message) {
@@ -150,14 +151,16 @@
return applyFilter(result);
}
- /**
- * Retourne la chaine traduite si possible.
+ /**
+ * Retourne la chaine traduite si possible dans la locale demandée.
*
+ * @param locale la locale dans lequel on souhaite la traduction
* @param message message formate avec la meme syntaxe que {@link
* String#format}
* @param args les parametres pour le message.
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
+ * @since 2.1
*/
public static String l_(Locale locale, String message, Object... args) {
@@ -273,7 +276,7 @@
}
/**
- * close i18n caches, says the store if exists
+ * Close i18n caches, says the store if exists.
* <p/>
* This method should be called to reset all caches (languages,
* bundles,...)
@@ -335,49 +338,4 @@
return filter;
}
- /**
- * @return the current store
- * @deprecated since 1.1, only keep for compatibility
- */
- @Deprecated
- public static I18nStore getLoader() {
- return getStore();
- }
-
- /**
- * Parse a list of {@link Locale} seperated by comma.
- * <p/>
- * Example : fr_FR,en_GB
- *
- * @param str the string representation of locale separated by comma
- * @return list of available locales
- * @throws IllegalArgumentException ia a locale is not valid
- * @deprecated since 1.1, prefer use the {@link I18nUtil#parseLocales(String)}
- */
- @Deprecated
- public static Locale[] parseLocales(String str)
- throws IllegalArgumentException {
- return I18nUtil.parseLocales(str);
- }
-
- /**
- * @param str the text representation of the locale
- * @return the locale, or default locale if could not parse the given one
- * @deprecated since 1.1, prefer use the {@link I18nUtil#newLocale(String)}
- */
- @Deprecated
- public static Locale newLocale(String str) {
- return I18nUtil.newLocale(str);
- }
-
- /**
- * @param language the language of the locale
- * @param country the country of the locale
- * @return the required locale
- * @deprecated since 1.1, prefer use the {@link I18nUtil#newLocale(String,String)}
- */
- @Deprecated
- public static Locale newLocale(String language, String country) {
- return I18nUtil.newLocale(language, country);
- }
}
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nFilter.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nFilter.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nFilter.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -23,7 +23,7 @@
* #L%
*/
-/* *
+/**
* i18nFilter.java
*
* Created: 2 déc. 2003
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -158,7 +158,7 @@
}
I18nLanguage result = getLanguage(locale);
language = result;
- //TC-20090702 the selected langue is the default locale, usefull for
+ //TC-20090702 the selected language is the default locale, usefull for
// objects dealing with the default locale (swing widgets,...)
Locale.setDefault(locale);
}
@@ -166,7 +166,7 @@
/**
* Close store and release cache ofg language.
* <p/>
- * Current language will be also clean.
+ * Current language will be also cleaned.
*/
protected void close() {
if (languages != null) {
@@ -186,8 +186,14 @@
}
/**
+ * Recherche un object de type {@link I18nLanguage} pour la locale donnée
+ * en paramètre dans le cache des langues chargées ({@link #languages}).
+ *
+ * Si un tel objet n'existe pas, alors on en crée un et on le place dans le
+ * cache.
+ *
* @param locale la locale du language recherche
- * @return le language trouve dans le cache, ou null.
+ * @return le language trouve dans le cache.
*/
protected I18nLanguage getLanguage(Locale locale) {
I18nLanguage result = null;
@@ -208,7 +214,6 @@
}
}
-
return result;
}
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/bundle/I18nBundleUtil.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/bundle/I18nBundleUtil.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/bundle/I18nBundleUtil.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -61,13 +61,6 @@
public static final String DIRECTORY_SEARCH_BUNDLE_PATTERN = "i18n";
- /**
- * @deprecated since 2.0, this is not compatible with os, so do not used it
- * any more.
- */
- @Deprecated
- public static final String SEARCH_BUNDLE_PATTERN = ".*i18n/.+\\.properties";
-
private static final I18nBundleEntry[] EMPTY_I18N_BUNDLE_ENTRYS_ARRAY =
new I18nBundleEntry[0];
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/ClassPathI18nInitializer.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/ClassPathI18nInitializer.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/ClassPathI18nInitializer.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -116,12 +116,11 @@
@Override
public I18nBundle[] resolvBundles() throws Exception {
- // detect bundles urls
+ // detect bundles urls
URL[] urls = resolvURLs();
// detect bundles
-
I18nBundle[] result = resolvBundles(urls);
return result;
}
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/DefaultI18nInitializer.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/DefaultI18nInitializer.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/DefaultI18nInitializer.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -162,10 +162,9 @@
return definitionURL;
}
-// @Override
+ public URL[] resolvURLs(String prefixURL,
+ Properties definition) throws Exception {
- public URL[] resolvURLs(String prefixURL, Properties definition) throws Exception {
-
// get locales from properties
String localesAsStr = definition.getProperty(BUNDLE_DEF_LOCALES);
@@ -206,11 +205,9 @@
String prefixURL = resolvDefinition(definition);
// detect bundles urls
-
URL[] urls = resolvURLs(prefixURL, definition);
// detect bundles
-
I18nBundle[] result = resolvBundles(urls);
return result;
}
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/UserI18nInitializer.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/UserI18nInitializer.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/init/UserI18nInitializer.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -158,20 +158,16 @@
}
// detect bundles urls
-
URL[] urls = resolvURLs(prefixURL, definition);
// detect bundles
-
I18nBundle[] bundles = resolvBundles(urls);
// detect bundles entries
-
I18nBundleEntry[] entries =
I18nBundleUtil.getBundleEntries(bundles);
// copy all bundle entries resource
-
for (I18nBundleEntry e : entries) {
URL url = e.getPath();
@@ -190,8 +186,7 @@
log.info("Create user file to create : " + dst);
}
- // recopie du fichier
-
+ // copy file
outStream = new FileOutputStream(dst);
try {
IOUtils.copy(url.openStream(), outStream);
Deleted: trunk/nuiton-i18n/src/main/java/org/nuiton/util/LocaleConverter.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/util/LocaleConverter.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/util/LocaleConverter.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -1,149 +0,0 @@
-/*
- * #%L
- * I18n :: Api
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2010 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
- * 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
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package org.nuiton.util;
-
-import org.apache.commons.beanutils.ConversionException;
-import org.apache.commons.beanutils.Converter;
-import static org.apache.commons.logging.LogFactory.getLog;
-
-import org.apache.commons.logging.Log;
-import org.nuiton.i18n.CountryEnum;
-import org.nuiton.i18n.LanguageEnum;
-
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * classe pour convertir une chaine en un objet {@link Locale}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @deprecated since 2.0.1, use the {@link org.nuiton.util.converter.LocaleConverter} instead
- */
-@Deprecated
-public class LocaleConverter implements Converter {
-
- private static final Pattern FULL_SCOPE_PATTERN =
- Pattern.compile("([a-zA-Z]{2})_([a-zA-Z]{2})");
-
- private static final Pattern MEDIUM_SCOPE_PATTERN =
- Pattern.compile("([a-zA-Z]{2})");
-
- /** to use log facility, just put in your code: log.info(\"...\"); */
- static Log log = getLog(LocaleConverter.class);
-
- @Override
- public Object convert(Class aClass, Object value) {
- if (value == null) {
- throw new ConversionException("can not convert null value in " +
- this + " convertor");
- }
- if (isEnabled(aClass)) {
- Object result;
- if (isEnabled(value.getClass())) {
- result = value;
- return result;
- }
- if (value instanceof String) {
- result = valueOf(((String) value).trim());
- return result;
- }
- }
- throw new ConversionException(
- "could not find a convertor for type " + aClass.getName() +
- " and value : " + value);
- }
-
- public Locale valueOf(String value) {
- try {
- Locale result = convertFullScope(value);
-
- if (result == null) {
- result = convertMediumScope(value);
- }
-
- if (result == null) {
- throw new ConversionException("could not convert locale " +
- value);
- }
-
- return result;
- } catch (Exception e) {
- throw new ConversionException("could not convert locale " + value +
- " for reason " + e.getMessage());
- }
- }
-
- private Locale convertFullScope(String value) {
- Matcher m = FULL_SCOPE_PATTERN.matcher(value);
- if (m.matches()) {
- // found a full scope pattern (language + country)
- LanguageEnum language =
- LanguageEnum.valueOf(m.group(1).toLowerCase());
- CountryEnum country = CountryEnum.valueOf(m.group(2).toUpperCase());
- if (language == null || country == null) {
- // not safe
- throw new ConversionException("could not convert locale " +
- value);
- }
- return new Locale(language.name(), country.name());
- }
- return null;
- }
-
- private Locale convertMediumScope(String value) {
- Matcher m = MEDIUM_SCOPE_PATTERN.matcher(value);
- if (m.matches()) {
- // found a medium scope pattern (only language)
- LanguageEnum language =
- LanguageEnum.valueOf(m.group(1).toLowerCase());
-
- if (language == null) {
- // not safe
- throw new ConversionException("could not convert locale " +
- value);
- }
- return new Locale(language.name());
- }
- return null;
- }
-
-
- public LocaleConverter() {
- if (log.isDebugEnabled()) {
- log.debug(this);
- }
- }
-
- protected boolean isEnabled(Class<?> aClass) {
- return Locale.class.equals(aClass);
- }
-
- public Class<?> getType() {
- return Locale.class;
- }
-
-}
Modified: trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nStoreTest.java
===================================================================
--- trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nStoreTest.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nStoreTest.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -51,7 +51,7 @@
I18nStore store;
@BeforeClass
- public static void beforeClass() throws MalformedURLException {
+ public static void beforeClass() {
I18n.setInitializer(
new DefaultI18nInitializer(I18nStoreTest.class.getSimpleName())
);
Added: trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
===================================================================
--- trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java (rev 0)
+++ trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -0,0 +1,113 @@
+package org.nuiton.i18n;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+
+import java.util.Locale;
+
+/**
+ * Test the class {@link I18n}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.1
+ */
+public class I18nTest {
+
+ @BeforeClass
+ public static void beforeClass() {
+ I18n.setInitializer(
+ new DefaultI18nInitializer(I18nStoreTest.class.getSimpleName())
+ );
+ }
+
+ @AfterClass
+ public static void afterClass() throws Exception {
+ I18n.setInitializer(null);
+ I18n.close();
+ }
+
+ @Test
+ public void testSimple() {
+
+ String expected;
+ String actual;
+
+ // passage en français
+
+ I18n.getStore().setLanguage(Locale.FRANCE);
+
+ expected = "Clef avec %s";
+ actual = I18n._("key.with.param");
+ Assert.assertEquals(expected, actual);
+
+ expected = "Clef avec param";
+ actual = I18n._("key.with.param", "param");
+ Assert.assertEquals(expected, actual);
+
+ // passage en anglais
+
+ I18n.getStore().setLanguage(Locale.UK);
+
+ expected = "Key with %s";
+ actual = I18n._("key.with.param");
+ Assert.assertEquals(expected, actual);
+
+ expected = "Key with param";
+ actual = I18n._("key.with.param", "param");
+ Assert.assertEquals(expected, actual);
+
+ // passage langue inconnue
+
+ I18n.getStore().setLanguage(Locale.CHINA);
+
+ expected = "key.with.param";
+ actual = I18n._("key.with.param");
+ Assert.assertEquals(expected, actual);
+
+ expected = "key.with.param";
+ actual = I18n._("key.with.param", "param");
+ Assert.assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testMultiLanguage() {
+
+ String expected;
+ String actual;
+
+ // en français
+
+ expected = "Clef avec %s";
+ actual = I18n.l_(Locale.FRANCE, "key.with.param");
+ Assert.assertEquals(expected, actual);
+
+ expected = "Clef avec param";
+ actual = I18n.l_(Locale.FRANCE, "key.with.param", "param");
+ Assert.assertEquals(expected, actual);
+
+ // en anglais
+
+ I18n.getStore().setLanguage(Locale.UK);
+
+ expected = "Key with %s";
+ actual = I18n.l_(Locale.UK, "key.with.param");
+ Assert.assertEquals(expected, actual);
+
+ expected = "Key with param";
+ actual = I18n.l_(Locale.UK, "key.with.param", "param");
+ Assert.assertEquals(expected, actual);
+
+ // dans une langue inconnue
+
+ expected = "key.with.param";
+ actual = I18n.l_(Locale.CHINA, "key.with.param");
+ Assert.assertEquals(expected, actual);
+
+ expected = "key.with.param";
+ actual = I18n.l_(Locale.CHINA, "key.with.param", "param");
+ Assert.assertEquals(expected, actual);
+ }
+}
Property changes on: trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/nuiton-i18n/src/test/java/org/nuiton/util/LocaleConverterTest.java
===================================================================
--- trunk/nuiton-i18n/src/test/java/org/nuiton/util/LocaleConverterTest.java 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/test/java/org/nuiton/util/LocaleConverterTest.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -1,137 +0,0 @@
-/*
- * #%L
- * I18n :: Api
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2010 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
- * 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
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package org.nuiton.util;
-
-import junit.framework.TestCase;
-import org.apache.commons.beanutils.Converter;
-
-import java.util.Locale;
-
-/**
- * Tests {@link LocaleConverter}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- */
-public class LocaleConverterTest extends TestCase {
-
- String toConvert;
-
- Locale excepted;
-
- Converter converter;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- converter = new LocaleConverter();
- }
-
- public void testConvertFull() throws Exception {
- toConvert = "fr_FR";
- excepted = Locale.FRANCE;
- assertEquals(toConvert, excepted);
-
- toConvert = "fr_fr";
- assertEquals(toConvert, excepted);
-
- toConvert = "FR_fr";
- assertEquals(toConvert, excepted);
-
- toConvert = "FR_FR";
- assertEquals(toConvert, excepted);
-
- toConvert = "\n\tFr_fR ";
- assertEquals(toConvert, excepted);
-
- toConvert = "en_GB";
- excepted = Locale.UK;
- assertEquals(toConvert, excepted);
-
- toConvert = "en_US";
- excepted = Locale.US;
- assertEquals(toConvert, excepted);
-
- //TODO Arch, we must also check coherence !
- toConvert = "fr_GB";
- excepted = new Locale("fr", "GB");
- assertEquals(toConvert, excepted);
- }
-
- public void testConvertMedium() throws Exception {
- toConvert = "fr";
- excepted = new Locale("fr");
- assertEquals(toConvert, excepted);
-
- toConvert = "fR";
- assertEquals(toConvert, excepted);
-
- toConvert = "FR";
- assertEquals(toConvert, excepted);
-
- toConvert = " fR \t";
- assertEquals(toConvert, excepted);
-
- toConvert = "en";
- excepted = new Locale("en");
- assertEquals(toConvert, excepted);
-
- toConvert = "es";
- excepted = new Locale("es");
- assertEquals(toConvert, excepted);
-
- }
-
- public void testConvertFailed() throws Exception {
-
- toConvert = null;
- assertConvertFailed(toConvert);
-
- toConvert = "";
- assertConvertFailed(toConvert);
-
- toConvert = "fr_";
- assertConvertFailed(toConvert);
-
- toConvert = "_FR";
- assertConvertFailed(toConvert);
-
- }
-
- protected void assertEquals(String toConvert, Locale expected) {
- Object result = converter.convert(Locale.class, toConvert);
- assertEquals(expected, result);
- }
-
- protected void assertConvertFailed(String toConvert) {
- try {
- converter.convert(Locale.class, toConvert);
- fail();
- } catch (Exception e) {
- assertTrue(true);
- }
-
- }
-}
Copied: trunk/nuiton-i18n/src/test/java/org/nuiton/util/converter/LocaleConverterTest.java (from rev 1842, trunk/nuiton-i18n/src/test/java/org/nuiton/util/LocaleConverterTest.java)
===================================================================
--- trunk/nuiton-i18n/src/test/java/org/nuiton/util/converter/LocaleConverterTest.java (rev 0)
+++ trunk/nuiton-i18n/src/test/java/org/nuiton/util/converter/LocaleConverterTest.java 2011-01-19 21:38:53 UTC (rev 1844)
@@ -0,0 +1,137 @@
+/*
+ * #%L
+ * I18n :: Api
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 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
+ * 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
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package org.nuiton.util.converter;
+
+import junit.framework.TestCase;
+import org.apache.commons.beanutils.Converter;
+
+import java.util.Locale;
+
+/**
+ * Tests {@link LocaleConverter}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ */
+public class LocaleConverterTest extends TestCase {
+
+ String toConvert;
+
+ Locale excepted;
+
+ Converter converter;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ converter = new LocaleConverter();
+ }
+
+ public void testConvertFull() throws Exception {
+ toConvert = "fr_FR";
+ excepted = Locale.FRANCE;
+ assertEquals(toConvert, excepted);
+
+ toConvert = "fr_fr";
+ assertEquals(toConvert, excepted);
+
+ toConvert = "FR_fr";
+ assertEquals(toConvert, excepted);
+
+ toConvert = "FR_FR";
+ assertEquals(toConvert, excepted);
+
+ toConvert = "\n\tFr_fR ";
+ assertEquals(toConvert, excepted);
+
+ toConvert = "en_GB";
+ excepted = Locale.UK;
+ assertEquals(toConvert, excepted);
+
+ toConvert = "en_US";
+ excepted = Locale.US;
+ assertEquals(toConvert, excepted);
+
+ //TODO Arch, we must also check coherence !
+ toConvert = "fr_GB";
+ excepted = new Locale("fr", "GB");
+ assertEquals(toConvert, excepted);
+ }
+
+ public void testConvertMedium() throws Exception {
+ toConvert = "fr";
+ excepted = new Locale("fr");
+ assertEquals(toConvert, excepted);
+
+ toConvert = "fR";
+ assertEquals(toConvert, excepted);
+
+ toConvert = "FR";
+ assertEquals(toConvert, excepted);
+
+ toConvert = " fR \t";
+ assertEquals(toConvert, excepted);
+
+ toConvert = "en";
+ excepted = new Locale("en");
+ assertEquals(toConvert, excepted);
+
+ toConvert = "es";
+ excepted = new Locale("es");
+ assertEquals(toConvert, excepted);
+
+ }
+
+ public void testConvertFailed() throws Exception {
+
+ toConvert = null;
+ assertConvertFailed(toConvert);
+
+ toConvert = "";
+ assertConvertFailed(toConvert);
+
+ toConvert = "fr_";
+ assertConvertFailed(toConvert);
+
+ toConvert = "_FR";
+ assertConvertFailed(toConvert);
+
+ }
+
+ protected void assertEquals(String toConvert, Locale expected) {
+ Object result = converter.convert(Locale.class, toConvert);
+ assertEquals(expected, result);
+ }
+
+ protected void assertConvertFailed(String toConvert) {
+ try {
+ converter.convert(Locale.class, toConvert);
+ fail();
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+
+ }
+}
Property changes on: trunk/nuiton-i18n/src/test/java/org/nuiton/util/converter/LocaleConverterTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_en_GB.properties
===================================================================
--- trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_en_GB.properties 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_en_GB.properties 2011-01-19 21:38:53 UTC (rev 1844)
@@ -24,3 +24,4 @@
###
key.one=First
key.two=Second
+key.with.param=Key with %s
\ No newline at end of file
Modified: trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_fr_FR.properties
===================================================================
--- trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_fr_FR.properties 2011-01-19 20:29:56 UTC (rev 1843)
+++ trunk/nuiton-i18n/src/test/resources/META-INF/I18nStoreTest_fr_FR.properties 2011-01-19 21:38:53 UTC (rev 1844)
@@ -24,3 +24,4 @@
###
key.one=Premier
key.two=Seconde
+key.with.param=Clef avec %s
1
0
r1843 - in trunk/maven-i18n-plugin/src: it/parsers/newProject it/parsers/newProject/src/main/java/org/nuiton/i18n/test it/parsers/withNewKeys it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test main/java/org/nuiton/i18n/plugin main/java/org/nuiton/i18n/plugin/parser/impl
by tchemit@users.nuiton.org 19 Jan '11
by tchemit@users.nuiton.org 19 Jan '11
19 Jan '11
Author: tchemit
Date: 2011-01-19 21:29:56 +0100 (Wed, 19 Jan 2011)
New Revision: 1843
Url: http://nuiton.org/repositories/revision/i18n/1843
Log:
Evolution #1208: Be able to force locale for translation
- change parser to detect the new keys from the l_(Locale,String,...) method
- improve its
- use now I18nFilter inside the ParserJavaMojo and no more the one from processor project
Modified:
trunk/maven-i18n-plugin/src/it/parsers/newProject/pom.xml
trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java
trunk/maven-i18n-plugin/src/it/parsers/newProject/verify.groovy
trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/pom.xml
trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java
trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/verify.groovy
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java
Modified: trunk/maven-i18n-plugin/src/it/parsers/newProject/pom.xml
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/newProject/pom.xml 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/it/parsers/newProject/pom.xml 2011-01-19 20:29:56 UTC (rev 1843)
@@ -55,6 +55,11 @@
</dependencies>
+ <properties>
+ <i18n.bundles>fr_FR,en_GB</i18n.bundles>
+ <i18n.verbose>true</i18n.verbose>
+ <i18n.keepGetters>true</i18n.keepGetters>
+ </properties>
<build>
<plugins>
@@ -92,7 +97,16 @@
</configuration>
</execution>
<execution>
- <!-- this execution is to test thread with no files -->
+ <id>gen</id>
+ <goals>
+ <goal>gen</goal>
+ </goals>
+ <!--<configuration>-->
+ <!--<keepGetters>true</keepGetters>-->
+ <!--</configuration>-->
+ </execution>
+ <!-- this execution is to test thread with no files -->
+ <!--execution>
<id>second</id>
<goals>
<goal>parserJava</goal>
@@ -101,7 +115,7 @@
<goal>parserGWTJava</goal>
</goals>
<phase>compile</phase>
- </execution>
+ </execution-->
</executions>
</plugin>
</plugins>
Modified: trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java 2011-01-19 20:29:56 UTC (rev 1843)
@@ -24,12 +24,19 @@
*/
package org.nuiton.i18n.test;
+import java.util.Locale;
+
import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.l_;
public class MyBean {
protected String field1 = n_("javaGetter.key1");
protected String field2 = _("javaGetter.key2");
+
+ public void method() {
+ l_(Locale.FRENCH,"javaGetter.key3");
+ }
}
Modified: trunk/maven-i18n-plugin/src/it/parsers/newProject/verify.groovy
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/newProject/verify.groovy 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/it/parsers/newProject/verify.groovy 2011-01-19 20:29:56 UTC (rev 1843)
@@ -23,40 +23,57 @@
* #L%
*/
-file = new File(basedir, 'target/generated-sources/i18n/java.getter');
-assert file.exists();
+def checkKeysInFile(path, keys) {
-content = file.text;
-assert content.contains( 'javaGetter.key1=' );
-assert content.contains( 'javaGetter.key2=' );
+ file = new File(basedir, path);
+ if (!file.exists()) {
+ println("Could not find file [" + file + "]");
+ return false;
+ }
-file = new File(basedir, 'target/generated-sources/i18n/validation.getter');
-assert file.exists();
+ content = file.text;
-content = file.text;
-assert content.contains( 'validationGetter.key1=' );
-assert content.contains( 'validationGetter.key2=' );
+ for (key in keys) {
+ if (!content.contains(key)) {
+ println("Could not find " + key + " in file " + file);
+ return false;
+ }
+ }
+ return true;
+}
-file = new File(basedir, 'target/generated-sources/i18n/jsp.getter');
-assert file.exists();
+assert checkKeysInFile('target/generated-sources/i18n/java.getter',
+ ['javaGetter.key1=', 'javaGetter.key2=', 'javaGetter.key3='])
-content = file.text;
-assert content.contains( 'jspGetter.key1=' );
-assert content.contains( 'jspGetter.key2=' );
+assert checkKeysInFile('target/generated-sources/i18n/validation.getter',
+ ['validationGetter.key1=', 'validationGetter.key2='])
-file = new File(basedir, 'target/generated-sources/i18n/tapestry.getter');
-assert file.exists();
+assert checkKeysInFile('target/generated-sources/i18n/jsp.getter',
+ ['jspGetter.key1=', 'jspGetter.key2='])
-content = file.text;
-assert content.contains( 'tmlGetter.key1=' );
-assert content.contains( 'tmlGetter.key2=' );
+assert checkKeysInFile('target/generated-sources/i18n/tapestry.getter',
+ ['tmlGetter.key1=', 'tmlGetter.key2='])
-file = new File(basedir, 'target/generated-sources/i18n/gwt-java.getter');
-assert file.exists();
+assert checkKeysInFile('target/generated-sources/i18n/gwt-java.getter',
+ ['gwtJavaGetter.key1=', 'gwtJavaGetter.key2=', 'gwtJavaGetter.key3='])
-content = file.text;
-assert content.contains( 'gwtJavaGetter.key1=' );
-assert content.contains( 'gwtJavaGetter.key2=' );
-assert content.contains( 'gwtJavaGetter.key3=' );
+assert checkKeysInFile('target/generated-sources/i18n/parsers-newProject_fr_FR.properties',
+ [
+ 'javaGetter.key1=', 'javaGetter.key2=', 'javaGetter.key3=',
+ 'validationGetter.key1=', 'validationGetter.key2=',
+ 'jspGetter.key1=', 'jspGetter.key2=',
+ 'tmlGetter.key1=', 'tmlGetter.key2=',
+ 'gwtJavaGetter.key1=', 'gwtJavaGetter.key2=', 'gwtJavaGetter.key3='
+ ])
+assert checkKeysInFile('target/generated-sources/i18n/parsers-newProject_en_GB.properties',
+ [
+ 'javaGetter.key1=', 'javaGetter.key2=', 'javaGetter.key3=',
+ 'validationGetter.key1=', 'validationGetter.key2=',
+ 'jspGetter.key1=', 'jspGetter.key2=',
+ 'tmlGetter.key1=', 'tmlGetter.key2=',
+ 'gwtJavaGetter.key1=', 'gwtJavaGetter.key2=', 'gwtJavaGetter.key3='
+ ])
+
+
return true;
Modified: trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/pom.xml
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/pom.xml 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/pom.xml 2011-01-19 20:29:56 UTC (rev 1843)
@@ -65,6 +65,11 @@
</dependencies>
+ <properties>
+ <i18n.bundles>fr_FR,en_GB</i18n.bundles>
+ <i18n.verbose>true</i18n.verbose>
+ <i18n.keepGetters>true</i18n.keepGetters>
+ </properties>
<build>
<plugins>
Modified: trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java 2011-01-19 20:29:56 UTC (rev 1843)
@@ -24,12 +24,20 @@
*/
package org.nuiton.i18n.test;
+import java.util.Locale;
+
import static org.nuiton.i18n.I18n._;
import static org.nuiton.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.l_;
public class MyBean {
protected String field1 = n_("javaGetter.key1");
protected String field2 = _("javaGetter.key2");
+
+
+ public void method() {
+ l_(Locale.FRENCH,"javaGetter.key3");
+ }
}
Modified: trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/verify.groovy
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/verify.groovy 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/verify.groovy 2011-01-19 20:29:56 UTC (rev 1843)
@@ -23,66 +23,122 @@
* #L%
*/
-file = new File(basedir, 'target/generated-sources/i18n/java.getter');
-assert file.exists();
-content = file.text;
-//assert content.contains( 'javaGetter.old.key1=' );
-//assert content.contains( 'javaGetter.old.key2=' );
-assert content.contains( 'javaGetter.key1=' );
-assert content.contains( 'javaGetter.key2=' );
+def checkKeysInFile(path, keys) {
-file = new File(basedir, 'target/generated-sources/i18n/validation.getter');
-assert file.exists();
+ file = new File(basedir, path);
+ if (!file.exists()) {
+ println("Could not find file [" + file + "]");
+ return false;
+ }
-content = file.text;
-assert content.contains( 'validationGetter.key1=' );
-assert content.contains( 'validationGetter.key2=' );
-assert content.contains( 'validationGetter.key3=' );
+ content = file.text;
-file = new File(basedir, 'target/generated-sources/i18n/jsp.getter');
-assert file.exists();
+ for (key in keys) {
+ if (!content.contains(key)) {
+ println("Could not find " + key + " in file " + file);
+ return false;
+ }
+ }
+ return true;
+}
-content = file.text;
-assert content.contains( 'jspGetter.key1=' );
-assert content.contains( 'jspGetter.key2=' );
+assert checkKeysInFile('target/generated-sources/i18n/java.getter',
+ ['javaGetter.key1=', 'javaGetter.key2=', 'javaGetter.key3='])
-file = new File(basedir, 'target/generated-sources/i18n/tapestry.getter');
-assert file.exists();
+assert checkKeysInFile('target/generated-sources/i18n/validation.getter',
+ ['validationGetter.key1=', 'validationGetter.key2=', 'validationGetter.key3='])
-content = file.text;
-assert content.contains( 'tmlGetter.key1=' );
-assert content.contains( 'tmlGetter.key2=' );
+assert checkKeysInFile('target/generated-sources/i18n/jsp.getter',
+ ['jspGetter.key1=', 'jspGetter.key2='])
+assert checkKeysInFile('target/generated-sources/i18n/tapestry.getter',
+ ['tmlGetter.key1=', 'tmlGetter.key2='])
-file = new File(basedir, 'target/generated-sources/i18n/gwt-java.getter');
-assert file.exists();
+assert checkKeysInFile('target/generated-sources/i18n/gwt-java.getter',
+ ['gwtJavaGetter.key1=', 'gwtJavaGetter.key2=', 'gwtJavaGetter.key3='])
-content = file.text;
-assert content.contains( 'gwtJavaGetter.key1=' );
-assert content.contains( 'gwtJavaGetter.key2=' );
-assert content.contains( 'gwtJavaGetter.key3=' );
+assert checkKeysInFile('target/generated-sources/i18n/parsers-withNewKeys_fr_FR.properties',
+ [
+ 'javaGetter.key1=', 'javaGetter.key2=', 'javaGetter.key3=',
+ 'javaGetter.old.key1=', 'javaGetter.old.key2=',
+ 'validationGetter.key1=', 'validationGetter.key2=', 'validationGetter.key3=',
+ 'jspGetter.key1=', 'jspGetter.key2=',
+ 'tmlGetter.key1=', 'tmlGetter.key2=',
+ 'gwtJavaGetter.key1=', 'gwtJavaGetter.key2=', 'gwtJavaGetter.key3='
+ ])
-file = new File(basedir, 'src/main/resources/i18n/parsers-withNewKeys_fr_FR.properties');
-assert file.exists();
+assert checkKeysInFile('target/generated-sources/i18n/parsers-withNewKeys_en_GB.properties',
+ [
+ 'javaGetter.key1=', 'javaGetter.key2=', 'javaGetter.key3=',
+ 'validationGetter.key1=', 'validationGetter.key2=',
+ 'jspGetter.key1=', 'jspGetter.key2=',
+ 'tmlGetter.key1=', 'tmlGetter.key2=',
+ 'gwtJavaGetter.key1=', 'gwtJavaGetter.key2=', 'gwtJavaGetter.key3='
+ ])
+//
+//file = new File(basedir, 'target/generated-sources/i18n/java.getter');
+//assert file.exists();
+//
+//content = file.text;
+////assert content.contains( 'javaGetter.old.key1=' );
+////assert content.contains( 'javaGetter.old.key2=' );
+//assert content.contains( 'javaGetter.key1=' );
+//assert content.contains( 'javaGetter.key2=' );
+//assert content.contains( 'javaGetter.key3=' );
-content = file.text;
-assert content.contains( 'javaGetter.old.key1=' );
-assert content.contains( 'javaGetter.old.key2=' );
-assert content.contains( 'javaGetter.key1=' );
-assert content.contains( 'javaGetter.key2=' );
-assert content.contains( 'validationGetter.key1=' );
-assert content.contains( 'validationGetter.key2=' );
-assert content.contains( 'validationGetter.key3=' );
-assert content.contains( 'jspGetter.key1=' );
-assert content.contains( 'jspGetter.key2=' );
+//file = new File(basedir, 'target/generated-sources/i18n/validation.getter');
+//assert file.exists();
+//
+//content = file.text;
+//assert content.contains( 'validationGetter.key1=' );
+//assert content.contains( 'validationGetter.key2=' );
+//assert content.contains( 'validationGetter.key3=' );
-assert content.contains( 'tmlGetter.key1=' );
-assert content.contains( 'tmlGetter.key2=' );
+//file = new File(basedir, 'target/generated-sources/i18n/jsp.getter');
+//assert file.exists();
+//
+//content = file.text;
+//assert content.contains( 'jspGetter.key1=' );
+//assert content.contains( 'jspGetter.key2=' );
+//
+//
+//file = new File(basedir, 'target/generated-sources/i18n/tapestry.getter');
+//assert file.exists();
+//
+//content = file.text;
+//assert content.contains( 'tmlGetter.key1=' );
+//assert content.contains( 'tmlGetter.key2=' );
-assert content.contains( 'gwtJavaGetter.key1=' );
-assert content.contains( 'gwtJavaGetter.key2=' );
-assert content.contains( 'gwtJavaGetter.key3=' );
+//file = new File(basedir, 'target/generated-sources/i18n/gwt-java.getter');
+//assert file.exists();
+//
+//content = file.text;
+//assert content.contains( 'gwtJavaGetter.key1=' );
+//assert content.contains( 'gwtJavaGetter.key2=' );
+//assert content.contains( 'gwtJavaGetter.key3=' );
+//file = new File(basedir, 'src/main/resources/i18n/parsers-withNewKeys_fr_FR.properties');
+//assert file.exists();
+//
+//content = file.text;
+//assert content.contains('javaGetter.old.key1=');
+//assert content.contains('javaGetter.old.key2=');
+//assert content.contains('javaGetter.key1=');
+//assert content.contains('javaGetter.key2=');
+//assert content.contains('javaGetter.key3=');
+//assert content.contains('validationGetter.key1=');
+//assert content.contains('validationGetter.key2=');
+//assert content.contains('validationGetter.key3=');
+//assert content.contains('jspGetter.key1=');
+//assert content.contains('jspGetter.key2=');
+//
+//assert content.contains('tmlGetter.key1=');
+//assert content.contains('tmlGetter.key2=');
+//
+//assert content.contains('gwtJavaGetter.key1=');
+//assert content.contains('gwtJavaGetter.key2=');
+//assert content.contains('gwtJavaGetter.key3=');
+
return true;
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java 2011-01-19 20:29:56 UTC (rev 1843)
@@ -168,6 +168,9 @@
}
if (!keepGetters) {
+ if (isVerbose()) {
+ getLog().info("Will delete getter " + bundleGetterOut);
+ }
deleteFile(bundleGetterOut);
}
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java 2011-01-19 20:29:56 UTC (rev 1843)
@@ -97,6 +97,9 @@
propertiesOut.putAll(propertiesIn);
if (!keepGetters) {
+ if (isVerbose()) {
+ getLog().info("Will delete getter " + bundleGetter);
+ }
deleteFile(bundleGetter);
}
if (!silent) {
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java 2011-01-19 16:24:40 UTC (rev 1842)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java 2011-01-19 20:29:56 UTC (rev 1843)
@@ -35,20 +35,22 @@
import org.nuiton.io.FileUpdater;
import org.nuiton.io.FileUpdaterHelper;
import org.nuiton.io.SortedProperties;
-import org.nuiton.processor.filters.I18nFilter;
+import org.nuiton.processor.filters.DefaultFilter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* To parse java files to detect new i18n keys.
- *
+ * <p/>
* <b>Note: </b> this goal must always be invoked before the {@code process-resources}
* phase, otherwise all files will be considered as uptodate.
- *
+ *
* @author jruchaud <ruchaud(a)codelutin.com>
* @author tchemit <tchemit(a)codelutin.com>
* @goal parserJava
@@ -128,13 +130,14 @@
protected static class JavaFileParser extends AbstractFileParser {
- protected final I18nFilter filter = new I18nFilter();
+ protected final I18nFilter filter;
public JavaFileParser(Log log,
String encoding,
SortedProperties oldParser,
boolean showTouchedFiles) {
super(log, encoding, oldParser, showTouchedFiles);
+ filter = new I18nFilter(log);
}
@Override
@@ -180,4 +183,131 @@
}
}
}
+
+ public static class I18nFilter extends DefaultFilter {
+
+ /** Instance logger */
+ private final Log log;
+
+// private String header = "_\\(\\s*\"";
+ private String header = "^_\\(\\s*\\\"|[^l]_\\(\\s*\\\"|l_\\([^,]+\\s*,\\s*\\\"";
+
+ private String footer = "\"\\s*(\\)|,|\\+|$)";
+
+ private Pattern headerPattern = Pattern.compile(getHeader());
+
+ private Pattern footerPattern = Pattern.compile(getFooter());
+
+ private Matcher matcher;
+
+ public I18nFilter(Log log) {
+ this.log = log;
+ }
+
+ protected void setFooter(String footer) {
+ this.footer = footer;
+ }
+
+ protected void setHeader(String header) {
+ this.header = header;
+ }
+
+ @Override
+ protected String getHeader() {
+ return header;
+ }
+
+ @Override
+ protected String getFooter() {
+ return footer;
+ }
+
+ @Override
+ public int getMatchIndexFor(String input, String sequence) {
+ int index = NOT_FOUND;
+
+ setMatcher(null);
+ if (sequence.equals(getHeader())) {
+ setMatcher(getHeaderPattern().matcher(input));
+ } else if (sequence.equals(getFooter())) {
+ setMatcher(getFooterPattern().matcher(input));
+ }
+ if (getMatcher() != null) {
+ try {
+ getMatcher().find();
+ index = getMatcher().start();
+ } catch (RuntimeException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Could not match with " + getMatcher() + " input " + input);
+ }
+ }
+ }
+
+ return index;
+ }
+
+ @Override
+ public int getMatchLengthFor(String sequence) {
+ int length = NOT_FOUND;
+
+ try {
+ length = getMatcher().end() - getMatcher().start();
+ } catch (RuntimeException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Could not match with " + getMatcher() + " input " + sequence);
+ }
+ }
+
+ return length;
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere entre le header et le
+ * footer.
+ *
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ @Override
+ protected String performInFilter(String ch) {
+ return ch.replaceAll("\"\\s*\\+\\s*\"", "") + "=";
+ }
+
+ @Override
+ public String performHeaderFooterFilter(String ch) {
+ return ch.substring(ch.indexOf('"') + 1, ch.lastIndexOf('"'));
+ }
+
+ /**
+ * methode appele lorsqu'on a la chaine entiere a l'exterieur du
+ * header/footer
+ *
+ * @param ch la chaine trouve
+ * @return ce qu'il faut ecrire dans le fichier de sortie
+ */
+ @Override
+ protected String performOutFilter(String ch) {
+ return EMPTY_STRING;
+ }
+
+ /** @return Returns the footerPattern. */
+ protected Pattern getFooterPattern() {
+ return footerPattern;
+ }
+
+ /** @return Returns the headerPattern. */
+ protected Pattern getHeaderPattern() {
+ return headerPattern;
+ }
+
+ /** @return Returns the matcher. */
+ protected Matcher getMatcher() {
+ return matcher;
+ }
+
+ /** @param matcher The matcher to set. */
+ protected void setMatcher(Matcher matcher) {
+ this.matcher = matcher;
+ }
+ }
}
1
0
19 Jan '11
Author: bpoussin
Date: 2011-01-19 17:24:40 +0100 (Wed, 19 Jan 2011)
New Revision: 1842
Url: http://nuiton.org/repositories/revision/i18n/1842
Log:
Anomalie #1208: Be able to force locale for translation
- rename method _(Locale locale, ...) to l_(Locale locale, ...)
Modified:
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2011-01-19 15:18:57 UTC (rev 1841)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2011-01-19 16:24:40 UTC (rev 1842)
@@ -45,7 +45,7 @@
* the translation support with the init(String language) or init(String
* language, String country), init(Localelocale) static methods in your main, (
* eg: I18n.init("fr","FR") ) <li> call the translate static method for each
- * sentence, ( eg: I18n._("hello you !") ) <li> create a resource file for each
+ * sentence, ( eg: I18n.l_("hello you !") ) <li> create a resource file for each
* language following the naming convention given in the
* java.util.ResourceBundle javadoc and translate all the sentence. </ul>
*
@@ -135,7 +135,7 @@
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
*/
- public static String _(Locale locale, String message) {
+ public static String l_(Locale locale, String message) {
// if the key to translate is null, just return null
if (message == null) {
@@ -159,7 +159,7 @@
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
*/
- public static String _(Locale locale, String message, Object... args) {
+ public static String l_(Locale locale, String message, Object... args) {
// if the key to translate is null, just return null
if (message == null) {
@@ -196,7 +196,7 @@
*/
public static String _(String message) {
Locale locale = getCurrentLanguage().getLocale();
- String result = _(locale, message);
+ String result = l_(locale, message);
return result;
}
@@ -211,7 +211,7 @@
*/
public static String _(String message, Object... args) {
Locale locale = getCurrentLanguage().getLocale();
- String result = _(locale, message, args);
+ String result = l_(locale, message, args);
return result;
}
@@ -223,7 +223,7 @@
* <p/>
* Par exemple :
* <pre>String key = "nuitonutils.key";
- * String result = _(key)</pre>
+ * String result = l_(key)</pre>
* fonctionnera, mais la chaine n'aura pas été marquée comme devant être
* internationalisé.
* <p/>
@@ -257,7 +257,7 @@
* <p/>
* Par exemple :
* <pre>String key = "nuitonutils.key";
- * String result = _(key)</pre>
+ * String result = l_(key)</pre>
* fonctionnera, mais la chaine n'aura pas été marquée comme devant être
* internationalisé.
* <p/>
1
0
19 Jan '11
Author: bpoussin
Date: 2011-01-19 16:18:57 +0100 (Wed, 19 Jan 2011)
New Revision: 1841
Url: http://nuiton.org/repositories/revision/i18n/1841
Log:
Anomalie #1208: Be able to force locale for translation
- _(Locale locale, ...) method added
- old _(String message, ...) method call new _(Locale locale, ...) method
- I18nStore add translation in cache when get is call (before this is done when set is done)
- lazy loading of initializer in get method
Modified:
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2011-01-12 17:17:54 UTC (rev 1840)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2011-01-19 15:18:57 UTC (rev 1841)
@@ -118,10 +118,6 @@
* @param locale language to use
*/
public static void init(Locale locale) {
- if (initializer == null) {
- initializer = new ClassPathI18nInitializer();
- }
-
if (locale == null) {
// use default locale
locale = I18nUtil.newLocale(null, null);
@@ -134,18 +130,19 @@
/**
* Retourne la chaine traduite si possible.
*
+ * @param locale la locale dans lequel on souhaite la traduction
* @param message la chaine a traduire
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
*/
- public static String _(String message) {
+ public static String _(Locale locale, String message) {
// if the key to translate is null, just return null
if (message == null) {
return null;
}
- I18nLanguage language = getCurrentLanguage();
+ I18nLanguage language = getStore().getLanguage(locale);
String result = message;
if (language != null) {
result = language.translate(message);
@@ -153,7 +150,7 @@
return applyFilter(result);
}
- /**
+ /**
* Retourne la chaine traduite si possible.
*
* @param message message formate avec la meme syntaxe que {@link
@@ -162,14 +159,14 @@
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
*/
- public static String _(String message, Object... args) {
+ public static String _(Locale locale, String message, Object... args) {
// if the key to translate is null, just return null
if (message == null) {
return null;
}
- I18nLanguage language = getCurrentLanguage();
+ I18nLanguage language = getStore().getLanguage(locale);
String result = message;
if (language != null) {
result = language.translate(message);
@@ -191,6 +188,34 @@
}
/**
+ * Retourne la chaine traduite si possible.
+ *
+ * @param message la chaine a traduire
+ * @return la traduction si possible ou la chaine passee en parametre
+ * sinon.
+ */
+ public static String _(String message) {
+ Locale locale = getCurrentLanguage().getLocale();
+ String result = _(locale, message);
+ return result;
+ }
+
+ /**
+ * Retourne la chaine traduite si possible.
+ *
+ * @param message message formate avec la meme syntaxe que {@link
+ * String#format}
+ * @param args les parametres pour le message.
+ * @return la traduction si possible ou la chaine passee en parametre
+ * sinon.
+ */
+ public static String _(String message, Object... args) {
+ Locale locale = getCurrentLanguage().getLocale();
+ String result = _(locale, message, args);
+ return result;
+ }
+
+ /**
* Retourne la chaine passée en argument.
* <p/>
* Utile surtout pour collecter les chaines et ne pas les traduires à leur
@@ -261,6 +286,10 @@
}
public static I18nInitializer getInitializer() {
+ if (initializer == null) {
+ initializer = new ClassPathI18nInitializer();
+ }
+
return initializer;
}
@@ -274,7 +303,7 @@
public static I18nStore getStore() {
if (store == null) {
- store = new I18nStore(DEFAULT_LOCALE, initializer);
+ store = new I18nStore(DEFAULT_LOCALE, getInitializer());
}
return store;
}
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java 2011-01-12 17:17:54 UTC (rev 1840)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java 2011-01-19 15:18:57 UTC (rev 1841)
@@ -157,13 +157,6 @@
log.debug("locale: " + locale);
}
I18nLanguage result = getLanguage(locale);
- if (result == null) {
- result = addLanguage(locale);
- } else {
- if (log.isDebugEnabled()) {
- log.debug("using cached language : " + result);
- }
- }
language = result;
//TC-20090702 the selected langue is the default locale, usefull for
// objects dealing with the default locale (swing widgets,...)
@@ -197,15 +190,26 @@
* @return le language trouve dans le cache, ou null.
*/
protected I18nLanguage getLanguage(Locale locale) {
-
+ I18nLanguage result = null;
if (!(languages == null || languages.isEmpty())) {
for (I18nLanguage l : languages) {
if (locale.equals(l.getLocale())) {
- return l;
+ result = l;
+ break;
}
}
}
- return null;
+
+ if (result == null) {
+ result = addLanguage(locale);
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("using cached language : " + result);
+ }
+ }
+
+
+ return result;
}
protected I18nLanguage addLanguage(Locale locale) {
1
0
Author: jcouteau
Date: 2011-01-12 18:17:54 +0100 (Wed, 12 Jan 2011)
New Revision: 1840
Url: http://nuiton.org/repositories/revision/i18n/1840
Log:
Quickly add some doc about generateDefaultLocale option, parserTapestry and parserGWTJava
Modified:
trunk/src/site/apt/index.apt
trunk/src/site/en/apt/index.apt
Modified: trunk/src/site/apt/index.apt
===================================================================
--- trunk/src/site/apt/index.apt 2011-01-12 16:41:52 UTC (rev 1839)
+++ trunk/src/site/apt/index.apt 2011-01-12 17:17:54 UTC (rev 1840)
@@ -50,6 +50,16 @@
- {{{./ant-i18n-task/index.html}I18n Ant task}} (ce module a été désactivé depuis la version 2.0)
+Quoi de neuf dans la version 2.1
+
+ Il est maintenant possible de générer une locale par défaut (par exemple
+ mesTraductions.properties) en utilisant l'option generateDefaultLocale dans
+ votre pom.
+
+ Un <<parserTapestry>> et un <<parserGWTJava>> ont été ajoutés. Le parseur GWT
+ récupère toutes les clés identifiées par l'annotation @Key. En le couplant
+ avec le parseurXML, vous pouvez gérer complètement vos traductions avec nuiton-i18n.
+
Quoi de nouveau dans la version 2.0
Depuis la version 2.0, les bundles i18n générés (dans <src/main/resources/i18n>)
Modified: trunk/src/site/en/apt/index.apt
===================================================================
--- trunk/src/site/en/apt/index.apt 2011-01-12 16:41:52 UTC (rev 1839)
+++ trunk/src/site/en/apt/index.apt 2011-01-12 17:17:54 UTC (rev 1840)
@@ -51,6 +51,15 @@
- {{{./maven-i18n-plugin/index.html}I18n Maven Plugin}}
+What's new in 2.1 version
+ It is now possible to generate a default locale (for example
+ myTranslations.properties) using the generateDefaultLocale option in your pom.
+
+ A <<parserTapestry>> and <<parserGWTJava>> have been introduced. The GWT parser gathers
+ all the keys identified by the annotation @Key. Coupling it with the XML Parser
+ for UIBinder screens, you can manage all the translations of your application
+ using nuiton-i18n.
+
What is new in the 2.0 version
Since 2.0 version, the generated i18n bundles (in <src/main/resources/i18n>)
1
0
r1839 - in trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin: . bundle parser/impl
by tchemit@users.nuiton.org 12 Jan '11
by tchemit@users.nuiton.org 12 Jan '11
12 Jan '11
Author: tchemit
Date: 2011-01-12 17:41:52 +0100 (Wed, 12 Jan 2011)
New Revision: 1839
Url: http://nuiton.org/repositories/revision/i18n/1839
Log:
Evolution #1203: Add generateDefaultLocale parameter in Bundle like mojos
Modified:
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java 2011-01-12 16:41:52 UTC (rev 1839)
@@ -199,16 +199,21 @@
/**
* @param root le repertoire ou sont stockes les fichiers i18n
* @param artifactId le nom de l'artifact
- * @param locale le nom du bundle
+ * @param locale le nom de la locale (peut-être nulle)
* @param create {@code true} pour creer le fichier si non present
* @return le fichier i18n
* @throws IOException si probleme lors de la creation du fichier
*/
- public File getI18nFile(File root, String artifactId,
- Locale locale, boolean create) throws IOException {
- File file = new File(
- root.getAbsolutePath() + File.separatorChar + artifactId +
- "_" + locale.toString() + ".properties");
+ public File getI18nFile(File root,
+ String artifactId,
+ Locale locale,
+ boolean create) throws IOException {
+ String path = root.getAbsolutePath() + File.separatorChar + artifactId;
+ if (locale != null) {
+ path += "_" + locale.toString();
+ }
+ path += ".properties";
+ File file = new File(path);
if (create && !file.exists()) {
createNewFile(file);
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/AbstractMakeI18nBundleMojo.java 2011-01-12 16:41:52 UTC (rev 1839)
@@ -24,9 +24,11 @@
*/
package org.nuiton.i18n.plugin.bundle;
+import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.MojoFailureException;
import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
@@ -59,6 +61,15 @@
protected String bundleOutputName;
/**
+ * A flag to generate a bundle with the first locale defined as a default
+ * bundle (with no locale specialization).
+ *
+ * @parameter expression="${i18n.generateDefaultLocale}" default-value="false"
+ * @since 2.1
+ */
+ protected boolean generateDefaultLocale;
+
+ /**
* A flag to check that bundles are complete (no missing i18n translations).
* <p/>
* <b>Note :</b> This behaviour will be activated is {@link #failsIfWarning} is on.
@@ -127,4 +138,50 @@
}
}
+ /**
+ * Gets the bundle file for the given parameters.
+ *
+ * @param root the root directory where bundles are stored
+ * @param artifactId the artifactId (says the prefix of bundle)
+ * @param locale the locale used in bundle ({@code null} means no locale specialized)
+ * @param create a flag to create the file if none existing
+ * @return the bundle file
+ * @throws IOException if any IO problem while creating it (if needed).
+ * @since 2.1
+ */
+ protected abstract File getBundleFile(File root,
+ String artifactId,
+ Locale locale,
+ boolean create) throws IOException;
+
+ /**
+ * Generates the default bundle, says the bundle with no locale specialized.
+ * <p/>
+ * This bundle is a copy of the bundle of the first locale (which in fact
+ * is considered as the main locale).
+ *
+ * @throws IOException if any IO problem while the copy.
+ * @since 2.1
+ */
+ protected void generateDefaultBundle() throws IOException {
+
+ File bundleFirstLocale = getBundleFile(bundleOutputDir,
+ bundleOutputName,
+ locales[0],
+ false
+ );
+
+ File bundleWithoutLocale = getBundleFile(bundleOutputDir,
+ bundleOutputName,
+ null,
+ false
+ );
+
+ if (!isSilent()) {
+ getLog().info("Generate default bundle at " + bundleWithoutLocale);
+ }
+
+ FileUtils.copyFile(bundleFirstLocale, bundleWithoutLocale);
+ }
+
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/BundleMojo.java 2011-01-12 16:41:52 UTC (rev 1839)
@@ -25,6 +25,8 @@
package org.nuiton.i18n.plugin.bundle;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
import org.nuiton.i18n.bundle.I18nBundleEntry;
import org.nuiton.i18n.bundle.I18nBundleUtil;
import org.nuiton.i18n.init.DefaultI18nInitializer;
@@ -195,6 +197,10 @@
failsIfWarning();
+ if (generateDefaultLocale) {
+ generateDefaultBundle();
+ }
+
if (generateDefinitionFile) {
generateDefinitionFile(version, bundleDico);
@@ -205,6 +211,14 @@
}
}
+ @Override
+ protected File getBundleFile(File root,
+ String artifactId,
+ Locale locale,
+ boolean create) throws IOException {
+ return getI18nFile(root, artifactId, locale, create);
+ }
+
protected void generateDefinitionFile(String version,
Map<Locale, String> bundleDico) throws IOException {
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/bundle/TapestryBundleMojo.java 2011-01-12 16:41:52 UTC (rev 1839)
@@ -72,7 +72,7 @@
long t0 = System.nanoTime();
- File bundleOut = getTapestryI18nFile(
+ File bundleOut = getBundleFile(
bundleOutputDir,
bundleOutputName,
locale,
@@ -131,13 +131,16 @@
failsIfWarning();
+ if (generateDefaultLocale) {
+ generateDefaultBundle();
+ }
+
if (!silent && verbose) {
getLog().info("done in " +
PluginHelper.convertTime(t00, System.nanoTime()));
}
}
-
/**
* @param root le repertoire ou sont stockes les fichiers i18n
* @param artifactId le nom de l'artifact
@@ -146,13 +149,18 @@
* @return le fichier i18n
* @throws IOException si probleme lors de la creation du fichier
*/
- public File getTapestryI18nFile(File root,
- String artifactId,
- Locale locale,
- boolean create) throws IOException {
+ @Override
+ protected File getBundleFile(File root,
+ String artifactId,
+ Locale locale,
+ boolean create) throws IOException {
+ String path = root.getAbsolutePath() + File.separatorChar + artifactId;
+ if (locale != null) {
+ path += "_" + locale.getLanguage();
+ }
+ path += ".properties";
File file = new File(
- root.getAbsolutePath() + File.separatorChar + artifactId +
- "_" + locale.getLanguage() + ".properties");
+ path);
if (create && !file.exists()) {
createNewFile(file);
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java 2011-01-12 16:41:52 UTC (rev 1839)
@@ -282,67 +282,5 @@
return footer;
}
}
-
- // /**
- // * To remove jsp comment from files.
- // *
- // * @author tchemit <chemit(a)codelutin.com>
- // * @since 2.0
- // */
- // public static class JspCommentFilter extends DefaultFilter {
- //
- // private String header = "<" + "%" + "-" + "-";
- //
- // private String footer = "-" + "-" + "%" + ">";
- //
- // @Override
- // protected String performInFilter(String ch) {
- // return EMPTY_STRING;
- // }
- //
- // @Override
- // protected String performOutFilter(String ch) {
- // return ch;
- // }
- //
- // protected String getHeader() {
- // return header;
- // }
- //
- // protected String getFooter() {
- // return footer;
- // }
- // }
- //
- // /**
- // * To remove jsp directive from files.
- // *
- // * @author tchemit <chemit(a)codelutin.com>
- // * @since 2.0
- // */
- // public static class JspDirectiveFilter extends DefaultFilter {
- //
- // private String header = "<" + "%";
- //
- // private String footer = "%" + ">";
- //
- // @Override
- // protected String performInFilter(String ch) {
- // return EMPTY_STRING;
- // }
- //
- // @Override
- // protected String performOutFilter(String ch) {
- // return ch;
- // }
- //
- // protected String getHeader() {
- // return header;
- // }
- //
- // protected String getFooter() {
- // return footer;
- // }
- // }
}
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java 2011-01-12 16:41:52 UTC (rev 1839)
@@ -294,6 +294,5 @@
extractKeys(extractor2, fileTemp, encoding, verbose, keys);
saveKeysToFile(fileout, keys);
}
-
}
}
1
0
r1838 - in trunk/maven-i18n-plugin/src: it/parsers/newProject/src/main/java/com/google/gwt/i18n/client it/parsers/withNewKeys/src/main/java/com/google/gwt/i18n/client main/java/org/nuiton/i18n/plugin main/java/org/nuiton/i18n/plugin/parser main/java/org/nuiton/i18n/plugin/parser/impl site site/apt site/en/apt
by tchemit@users.nuiton.org 04 Jan '11
by tchemit@users.nuiton.org 04 Jan '11
04 Jan '11
Author: tchemit
Date: 2011-01-04 14:54:04 +0100 (Tue, 04 Jan 2011)
New Revision: 1838
Url: http://nuiton.org/repositories/revision/i18n/1838
Log:
update licenses svn keywords + doc
Modified:
trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java
trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractFileParser.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractI18nParserMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/FileParser.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nParserConfiguration.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nSourceEntry.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserEvent.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserException.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserExecutor.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/SourceEntry.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/AbstractParserXmlMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserValidationMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserXmlUserMojo.java
trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ProcessorHelper.java
trunk/maven-i18n-plugin/src/site/apt/index.apt
trunk/maven-i18n-plugin/src/site/en/apt/index.apt
trunk/maven-i18n-plugin/src/site/site_en.xml
trunk/maven-i18n-plugin/src/site/site_fr.xml
Modified: trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/it/parsers/newProject/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * I18n :: Maven Plugin
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2007 - 2011 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
+ * 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
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package com.google.gwt.i18n.client;
import java.lang.annotation.*;
Modified: trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java
===================================================================
--- trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/it/parsers/withNewKeys/src/main/java/com/google/gwt/i18n/client/LocalizableResource.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * I18n :: Maven Plugin
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2007 - 2011 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
+ * 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
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package com.google.gwt.i18n.client;
import java.lang.annotation.*;
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/AbstractI18nMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GenerateMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/GetterMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractFileParser.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractFileParser.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractFileParser.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractI18nParserMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractI18nParserMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/AbstractI18nParserMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/FileParser.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/FileParser.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/FileParser.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nParserConfiguration.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nParserConfiguration.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nParserConfiguration.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nSourceEntry.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nSourceEntry.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/I18nSourceEntry.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserEvent.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserEvent.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserEvent.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserException.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserException.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserException.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserExecutor.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserExecutor.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/ParserExecutor.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 poussin. All rights reserved.
+ * Copyright (C) 2010 poussin, Tony Chemit. All rights reserved.
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/SourceEntry.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/SourceEntry.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/SourceEntry.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/AbstractParserXmlMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/AbstractParserXmlMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/AbstractParserXmlMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserGWTJavaMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * I18n :: Maven Plugin
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Tony Chemit
+ * %%
+ * 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
+ * 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
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package org.nuiton.i18n.plugin.parser.impl;
import org.apache.maven.plugin.logging.Log;
@@ -20,7 +44,7 @@
import java.util.Set;
/**
- * To detect from GWT java files Tapestry templates new I18n keys, says content of patterns :
+ * To detect from GWT java files new I18n keys, says content of patterns :
* <ul>
* <li>{@code @Key("XXX")}</li>
* <li>{@code @LocalizableResource.Key("XXX")}</li>
@@ -130,9 +154,9 @@
public FileParser newFileParser() {
return new GWTJavaFileParser(getLog(),
- getEncoding(),
- oldParser,
- isShowTouchedFiles()
+ getEncoding(),
+ oldParser,
+ isShowTouchedFiles()
);
}
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserValidationMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserValidationMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserValidationMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserXmlUserMojo.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserXmlUserMojo.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserXmlUserMojo.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2007 - 2010 CodeLutin
+ * Copyright (C) 2007 - 2010 CodeLutin, Tony Chemit
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Modified: trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ProcessorHelper.java
===================================================================
--- trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ProcessorHelper.java 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ProcessorHelper.java 2011-01-04 13:54:04 UTC (rev 1838)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * I18n :: Maven Plugin
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2011 CodeLutin, Tony Chemit
+ * %%
+ * 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
+ * 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
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
package org.nuiton.i18n.plugin.parser.impl;
import org.apache.commons.io.FileUtils;
Modified: trunk/maven-i18n-plugin/src/site/apt/index.apt
===================================================================
--- trunk/maven-i18n-plugin/src/site/apt/index.apt 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/site/apt/index.apt 2011-01-04 13:54:04 UTC (rev 1838)
@@ -44,6 +44,8 @@
* {{{./parserJsp-mojo.html} i18n:parserJsp}} parse JSP sources.
+ * {{{./parserGWTJava-mojo.html} i18n:parserGWTJava}} parse GWT java sources.
+
* {{{./parserTapestry-mojo.html} i18n:parserTapestry}} parse Tapestry templates sources.
* {{{./get-mojo.html} i18n:get}} assembly getter computed by parser-like goals.
Modified: trunk/maven-i18n-plugin/src/site/en/apt/index.apt
===================================================================
--- trunk/maven-i18n-plugin/src/site/en/apt/index.apt 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/site/en/apt/index.apt 2011-01-04 13:54:04 UTC (rev 1838)
@@ -44,6 +44,8 @@
* {{{./parserJsp-mojo.html} i18n:parserJsp}} parse jsp sources.
+ * {{{./parserGWTJava-mojo.html} i18n:parserGWTJava}} parse GWT java sources.
+
* {{{./parserTapestry-mojo.html} i18n:parserTapestry}} parse Tapestry template sources.
* {{{./get-mojo.html} i18n:get}} assembly getter computed by parser-like goals.
Modified: trunk/maven-i18n-plugin/src/site/site_en.xml
===================================================================
--- trunk/maven-i18n-plugin/src/site/site_en.xml 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/site/site_en.xml 2011-01-04 13:54:04 UTC (rev 1838)
@@ -53,6 +53,7 @@
<item name="parserJava" href="parserJava-mojo.html"/>
<item name="parserXml" href="parserXml-mojo.html"/>
<item name="parserJsp" href="parserJsp-mojo.html"/>
+ <item name="parserGWTJava" href="parserGWTJava-mojo.html"/>
<item name="parserTapestry" href="parserTapestry-mojo.html"/>
<item name="parserValidation" href="parserValidation-mojo.html"/>
<item name="get" href="get-mojo.html"/>
Modified: trunk/maven-i18n-plugin/src/site/site_fr.xml
===================================================================
--- trunk/maven-i18n-plugin/src/site/site_fr.xml 2011-01-04 13:43:41 UTC (rev 1837)
+++ trunk/maven-i18n-plugin/src/site/site_fr.xml 2011-01-04 13:54:04 UTC (rev 1838)
@@ -52,6 +52,7 @@
<item name="parserXml" href="parserXml-mojo.html"/>
<item name="parserJsp" href="parserJsp-mojo.html"/>
<item name="parserTapestry" href="parserTapestry-mojo.html"/>
+ <item name="parserGWTJava" href="parserGWTJava-mojo.html"/>
<item name="parserValidation" href="parserValidation-mojo.html"/>
<item name="get" href="get-mojo.html"/>
<item name="gen" href="gen-mojo.html"/>
1
0