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
February 2014
- 4 participants
- 32 discussions
Author: tchemit
Date: 2014-02-03 12:39:42 +0100 (Mon, 03 Feb 2014)
New Revision: 2016
Url: http://nuiton.org/projects/i18n/repository/revisions/2016
Log:
refs #2687: Rename I18n methods to be compatible with jre 8
fixes #1586: Add new AST parser for java file
Modified:
trunk/i18n-maven-plugin/pom.xml
trunk/i18n-maven-plugin/src/it/ano-1494/iso-8859-1/src/main/java/org/nuiton/i18n/MessageConstants.java
trunk/i18n-maven-plugin/src/it/ano-1494/migrate/src/main/java/org/nuiton/i18n/MessageConstants.java
trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/main/java/org/nuiton/i18n/MessageConstants.java
trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/test/java/org/nuiton/i18n/ReadTest.java
trunk/i18n-maven-plugin/src/it/ano-672/src/test/java/org/nuiton/i18n/I18nTest.java
trunk/i18n-maven-plugin/src/it/evo-1507/src/test/java/org/nuiton/i18n/ReadMessageFormatTest.java
trunk/i18n-maven-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java
trunk/i18n-maven-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java
trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java
trunk/i18n-maven-plugin/src/test/java/org/nuiton/i18n/plugin/parser/impl/JavaFileParserTest.java
trunk/nuiton-i18n-editor/pom.xml
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx
trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx
trunk/nuiton-i18n/pom.xml
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nBundleBridge.java
trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java
trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
trunk/pom.xml
trunk/src/site/apt/helloWorld.apt
trunk/src/site/apt/library.apt.vm
trunk/src/site/en/apt/helloWorld.apt
trunk/src/site/en/apt/library.apt.vm
Modified: trunk/i18n-maven-plugin/pom.xml
===================================================================
--- trunk/i18n-maven-plugin/pom.xml 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/pom.xml 2014-02-03 11:39:42 UTC (rev 2016)
@@ -27,7 +27,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.5.3-SNAPSHOT</version>
+ <version>2.6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
@@ -54,6 +54,12 @@
</dependency>
<dependency>
+ <groupId>com.google.code.javaparser</groupId>
+ <artifactId>javaparser</artifactId>
+ <version>1.0.8</version>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton.processor</groupId>
<artifactId>nuiton-processor</artifactId>
</dependency>
Modified: trunk/i18n-maven-plugin/src/it/ano-1494/iso-8859-1/src/main/java/org/nuiton/i18n/MessageConstants.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/ano-1494/iso-8859-1/src/main/java/org/nuiton/i18n/MessageConstants.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/ano-1494/iso-8859-1/src/main/java/org/nuiton/i18n/MessageConstants.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -32,8 +32,8 @@
*/
public interface MessageConstants {
- String MESSAGE_1 = I18n._("message1");
+ String MESSAGE_1 = I18n.t("message1");
- String MESSAGE_2 = I18n._("message2");
+ String MESSAGE_2 = I18n.t("message2");
}
Modified: trunk/i18n-maven-plugin/src/it/ano-1494/migrate/src/main/java/org/nuiton/i18n/MessageConstants.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/ano-1494/migrate/src/main/java/org/nuiton/i18n/MessageConstants.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/ano-1494/migrate/src/main/java/org/nuiton/i18n/MessageConstants.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -32,8 +32,8 @@
*/
public interface MessageConstants {
- String MESSAGE_1 = I18n._("message1");
+ String MESSAGE_1 = I18n.t("message1");
- String MESSAGE_2 = I18n._("message2");
+ String MESSAGE_2 = I18n.t("message2");
}
Modified: trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/main/java/org/nuiton/i18n/MessageConstants.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/main/java/org/nuiton/i18n/MessageConstants.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/main/java/org/nuiton/i18n/MessageConstants.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -32,6 +32,6 @@
*/
public interface MessageConstants {
- String HELLO = I18n.n_("hello");
+ String HELLO = I18n.n("hello");
}
Modified: trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/test/java/org/nuiton/i18n/ReadTest.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/test/java/org/nuiton/i18n/ReadTest.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/ano-1494/utf-8/src/test/java/org/nuiton/i18n/ReadTest.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -47,7 +47,7 @@
new DefaultI18nInitializer("ResultBundle", null, "org/nuiton/");
I18n.init(initializer, new Locale("ja", "JP"));
- String message = I18n._(MessageConstants.HELLO);
+ String message = I18n.t(MessageConstants.HELLO);
Assert.assertEquals("こんにちは世界", message);
}
@@ -60,7 +60,7 @@
new DefaultI18nInitializer("ResultBundle", null, "org/nuiton/");
I18n.init(initializer, new Locale("fr", "FR"));
- String message = I18n._(MessageConstants.HELLO);
+ String message = I18n.t(MessageConstants.HELLO);
Assert.assertEquals("Salut à tous", message);
}
Modified: trunk/i18n-maven-plugin/src/it/ano-672/src/test/java/org/nuiton/i18n/I18nTest.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/ano-672/src/test/java/org/nuiton/i18n/I18nTest.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/ano-672/src/test/java/org/nuiton/i18n/I18nTest.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -59,13 +59,13 @@
I18n.setDefaultLocale(Locale.FRANCE);
expected = FRENCH_HELLO;
- actual = I18n._(I18n_KEY);
+ actual = I18n.t(I18n_KEY);
Assert.assertEquals(expected, actual);
I18n.setDefaultLocale(Locale.ENGLISH);
expected = ENGLISH_HELLO;
- actual = I18n._(I18n_KEY);
+ actual = I18n.t(I18n_KEY);
Assert.assertEquals(expected, actual);
}
@@ -75,11 +75,11 @@
String expected, actual;
expected = FRENCH_HELLO;
- actual = I18n.l_(Locale.FRANCE, I18n_KEY);
+ actual = I18n.l(Locale.FRANCE, I18n_KEY);
Assert.assertEquals(expected, actual);
expected = ENGLISH_HELLO;
- actual = I18n.l_(Locale.UK, I18n_KEY);
+ actual = I18n.l(Locale.UK, I18n_KEY);
Assert.assertEquals(expected, actual);
}
Modified: trunk/i18n-maven-plugin/src/it/evo-1507/src/test/java/org/nuiton/i18n/ReadMessageFormatTest.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/evo-1507/src/test/java/org/nuiton/i18n/ReadMessageFormatTest.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/evo-1507/src/test/java/org/nuiton/i18n/ReadMessageFormatTest.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -57,7 +57,7 @@
I18n.init(initializer, Locale.FRANCE);
String expected = "Message qui fait attention à la conversion de param";
- String actual = I18n._("lib.property.message2", "param");
+ String actual = I18n.t("lib.property.message2", "param");
Assert.assertEquals(expected, actual);
}
Modified: trunk/i18n-maven-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/parsers/newProject/src/main/java/org/nuiton/i18n/test/MyBean.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -26,17 +26,17 @@
import java.util.Locale;
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-import static org.nuiton.i18n.I18n.l_;
+import static org.nuiton.i18n.I18n.t;
+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 field1 = n("javaGetter.key1");
- protected String field2 = _("javaGetter.key2");
+ protected String field2 = t("javaGetter.key2");
public void method() {
- l_(Locale.FRENCH,"javaGetter.key3");
+ l(Locale.FRENCH, "javaGetter.key3");
}
}
Modified: trunk/i18n-maven-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java
===================================================================
--- trunk/i18n-maven-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/it/parsers/withNewKeys/src/main/java/org/nuiton/i18n/test/MyBean.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -26,18 +26,18 @@
import java.util.Locale;
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-import static org.nuiton.i18n.I18n.l_;
+import static org.nuiton.i18n.I18n.t;
+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 field1 = n("javaGetter.key1");
- protected String field2 = _("javaGetter.key2");
+ protected String field2 = t("javaGetter.key2");
public void method() {
- l_(Locale.FRENCH,"javaGetter.key3");
+ l(Locale.FRENCH, "javaGetter.key3");
}
}
Modified: trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java
===================================================================
--- trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJavaMojo.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -25,6 +25,14 @@
package org.nuiton.i18n.plugin.parser.impl;
+import japa.parser.JavaParser;
+import japa.parser.ParseException;
+import japa.parser.ast.CompilationUnit;
+import japa.parser.ast.expr.Expression;
+import japa.parser.ast.expr.MethodCallExpr;
+import japa.parser.ast.visitor.VoidVisitorAdapter;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
@@ -42,10 +50,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.util.List;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
@@ -121,14 +125,6 @@
protected static class JavaFileParser extends AbstractFileParser {
- /**
- * Pattern used to detect i18n keys.
- *
- * @since 2.3
- */
- protected final Pattern i18nPattern =
- Pattern.compile("(?:^_\\(\\s*\\\"|[^l]_\\(\\s*\\\"|l_\\([^,]+\\s*,\\s*\\\")(.*?)\"");
-
public JavaFileParser(Log log,
String encoding,
SortedProperties oldParser,
@@ -137,49 +133,79 @@
super(log, encoding, oldParser, acceptKeyPattern, showTouchedFiles);
}
- public Pattern getI18nPattern() {
- return i18nPattern;
- }
-
@Override
public void parseFile(File file) throws IOException {
- String line = null;
- LineNumberReader lnr = new LineNumberReader(new InputStreamReader(
- new FileInputStream(file), getEncoding()));
+
+ CompilationUnit cu;
+ FileInputStream inputStream = FileUtils.openInputStream(file);
try {
- while ((line = lnr.readLine()) != null) {
- parseLine(file, line);
- }
- } catch (Exception e) {
- if (line != null) {
- getLog().error(
- "could not parse line (" + lnr.getLineNumber() + ") '"
- + line + "' of file " + file);
- }
+ // parse the file
+ cu = JavaParser.parse(inputStream);
+ inputStream.close();
+ } catch (ParseException e) {
throw new ParserException(e);
} finally {
- lnr.close();
+ IOUtils.closeQuietly(inputStream);
}
+
+ // visit and print the methods names
+ new MethodVisitor(file).visit(cu, null);
}
@Override
public void parseLine(File file, String line) throws IOException {
+ }
- Matcher matcher = i18nPattern.matcher(line);
+ /**
+ * Simple visitor implementation for visiting MethodDeclaration nodes.
+ */
+ class MethodVisitor extends VoidVisitorAdapter<String> {
- while (matcher.find()) {
+ protected final File file;
- String key = matcher.group(1);
- if (getLog().isDebugEnabled()) {
- getLog().debug(file.getName() + " detected key = " + key);
+ MethodVisitor(File file) {
+ this.file = file;
+ }
+
+ @Override
+ public void visit(MethodCallExpr n, String arg) {
+
+ if (n.getName().matches("[nt]?")) {
+ if (n.getArgs().size() == 1) {
+ String firstArgs = n.getArgs().get(0).toString();
+ if (firstArgs.matches("^\"[^\"]+\"$")) {
+ String key = firstArgs.substring(1).substring(0, firstArgs.length() - 2);
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(file.getName() + " detected key = " + key);
+ }
+ ParserJavaMojo.JavaFileParser.this.registerKey(key);
+ }
+
+ }
}
-// // one key found in file, so file is marked as touched
-// setTouched(true);
+ if (n.getName().matches("[l]?")) {
+ if (n.getArgs().size() == 2) {
+ Expression arg1 = n.getArgs().get(0);
+ Expression arg2 = n.getArgs().get(1);
+ //FIXME tchemit-2014-02-03 We should test that the first args is Locale typed
+ boolean accept = arg1.toString().contains("Locale");
+ String keyParams = arg2.toString();
+ boolean match = accept && keyParams.matches("^\"[^\"]+\"$");
- // register key
- registerKey(key);
+ if (match) {
+ String key = keyParams.substring(1).substring(0, keyParams.length() - 2);
+ if (getLog().isDebugEnabled()) {
+ getLog().debug(file.getName() + " detected key = " + key);
+ }
+ ParserJavaMojo.JavaFileParser.this.registerKey(key);
+ }
+
+ }
+ }
}
}
+
}
+
}
Modified: trunk/i18n-maven-plugin/src/test/java/org/nuiton/i18n/plugin/parser/impl/JavaFileParserTest.java
===================================================================
--- trunk/i18n-maven-plugin/src/test/java/org/nuiton/i18n/plugin/parser/impl/JavaFileParserTest.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/i18n-maven-plugin/src/test/java/org/nuiton/i18n/plugin/parser/impl/JavaFileParserTest.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -24,6 +24,7 @@
*/
package org.nuiton.i18n.plugin.parser.impl;
+import org.apache.commons.io.FileUtils;
import org.apache.maven.plugin.logging.SystemStreamLog;
import org.junit.After;
import org.junit.Assert;
@@ -84,61 +85,145 @@
@Test
public void getKeys() throws IOException {
- File file = new File("getKeys");
- String line;
+ String classContent = "" +
+ "package org.nuiton.i18n;" +
+ "import org.nuiton.i18n.I18n;" +
+ "import static org.nuiton.i18n.I18n.t;" +
+ "class TestFuctionN {" +
+ "String key = I18n.t(\"a\");" +
+ "String key2 = org.nuiton.i18n.t(\"b\");" +
+ "String key3 = t(\"c\");" +
+ "String key4 = t(" +
+ "\"d\");" +
+ "String key5 = tt(\"e\");" +
+ "String t(String n) { return null; }" +
+ "}";
- line = "_(\"myKey\");";
- parseLine(file, line, "myKey");
+ File file = new File(FileUtils.getTempDirectory(), "getKeys");
+ FileUtils.write(file, classContent);
- line = "_(\"MyKey\" ";
- parseLine(file, line, "MyKey");
+// String line;
- line = " blabla _(\"myKey2\");";
- parseLine(file, line, "myKey2");
+// line = "n(\"a\");";
+ parseLine(file, new String[]{"e"}, "a", "b", "c", "d");
- line = " blabla \n somewhere else..." +
- "_(\"myKey3\");";
- parseLine(file, line, "myKey3");
+// File file = new File("getKeys");
+// String line;
+//
+// line = "t(\"myKey\");";
+// parseLine(file, line, "myKey");
+//
+// line = "t(\"MyKey\" ";
+// parseLine(file, line, "MyKey");
+//
+// line = " blabla t(\"myKey2\");";
+// parseLine(file, line, "myKey2");
+//
+// line = " blabla \n somewhere else..." +
+// "t(\"myKey3\");";
+// parseLine(file, line, "myKey3");
}
@Test
public void getKeys2() throws IOException {
- String line;
- File file = new File("getKeys2");
+ String classContent = "" +
+ "package org.nuiton.i18n;" +
+ "import org.nuiton.i18n.I18n;" +
+ "import static org.nuiton.i18n.I18n.n;" +
+ "class TestFuctionN {" +
+ "String key = I18n.n(\"a\");" +
+ "String key2 = org.nuiton.i18n.n(\"b\");" +
+ "String key3 = n(\"c\");" +
+ "String key4 = n(" +
+ "\"d\");" +
+ "String key5 = nn(\"e\");" +
+ "String nn(String n) { return null; }" +
+ "}";
- line = "n_(\"myKey\");";
- parseLine(file, line, "myKey");
+ File file = new File(FileUtils.getTempDirectory(), "getKeys2");
+ FileUtils.write(file, classContent);
- line = "n_(\"MyKey\" ";
- parseLine(file, line, "MyKey");
+// String line;
- line = " blabla n_(\"myKey2\");";
- parseLine(file, line, "myKey2");
+// line = "n(\"a\");";
+ parseLine(file, new String[]{"e"}, "a", "b", "c", "d");
- line = " blabla \n somewhere else..." +
- "n_(\"myKey3\");";
- parseLine(file, line, "myKey3");
+// line = ".n(\"b\");";
+// parseLine(file, line, "b");
+//
+// line = " n(\"c\");";
+// parseLine(file, line, "c");
+//
+// line = "aan(\"d\");";
+// parseBadLine(file, line, "d");
+//
+// line = "aa n(\"e\");";
+// parseLine(file, line, "e");
+//
+// line = "n(\"f\" ";
+// parseLine(file, line, "f");
+//
+// line = " blabla n(\"g\");";
+// parseLine(file, line, "g");
+//
+// line = " blabla \n somewhere else..." +
+// "n(\"h\");";
+// parseLine(file, line, "h");
}
@Test
public void getKeys3() throws IOException {
- String line;
- File file = new File("getKeys3");
+ String classContent = "" +
+ "package org.nuiton.i18n;" +
+ "import org.nuiton.i18n.I18n;" +
+ "import java.util.Locale;" +
+ "import static org.nuiton.i18n.I18n.l;" +
+ "import static java.util.Locale.UK;" +
+ "class TestFuctionN {" +
+ "String key = I18n.l(Locale.UK, \"a\");" +
+ "/*FIXME Can't detect this String key = I18n.l(UK, \"aa\");*/" +
+ "String key2 = org.nuiton.i18n.l(Locale.UK, \"b\");" +
+ "String key3 = l(Locale.UK, \"c\");" +
+ "String key4 = l(Locale.UK, " +
+ "\"d\");" +
+ "String key5 = ll(java.util.Locale.UK, \"e\");" +
+ "String t(String n) { return null; }" +
+ "}";
- line = "l_(Locale.UK, \"myKey\");";
- parseLine(file, line, "myKey");
+ File file = new File(FileUtils.getTempDirectory(), "getKeys3");
+ FileUtils.write(file, classContent);
- line = "l_( Locale.UK , \"MyKey\"";
- parseLine(file, line, "MyKey");
+// String line;
- line = " blabla l_(Locale.UK, \"myKey2\");";
- parseLine(file, line, "myKey2");
+// line = "n(\"a\");";
+ parseLine(file, new String[]{"e", "aa"}, "a", "b", "c", "d");
- line = " blabla \n somewhere else..." +
- "l_(Locale.UK, \"myKey3\");";
- parseLine(file, line, "myKey3");
+// String line;
+// File file = new File("getKeys3");
+//
+// line = "l(Locale.UK, \"myKey\");";
+// parseLine(file, line, "myKey");
+//
+// line = ".l(Locale.UK, \"myKey\");";
+// parseLine(file, line, "myKey");
+//
+// line = " l(Locale.UK, \"myKey\");";
+// parseLine(file, line, "myKey");
+//
+// line = "al(Locale.UK, \"myKey\");";
+// parseBadLine(file, line, "myKey");
+//
+// line = "l( Locale.UK , \"MyKey\"";
+// parseLine(file, line, "MyKey");
+//
+// line = " blabla l(Locale.UK, \"myKey2\");";
+// parseLine(file, line, "myKey2");
+//
+// line = " blabla \n somewhere else..." +
+// "l(Locale.UK, \"myKey3\");";
+// parseLine(file, line, "myKey3");
}
protected void parseLine(File f, String line, String... expectedKeys) throws IOException {
@@ -150,4 +235,32 @@
detectedKeys.contains(expectedKey));
}
}
+
+ protected void parseLine(File f, String[] notExpectedKeys, String... expectedKeys) throws IOException {
+ parser.parseFile(f);
+
+ for (String expectedKey : expectedKeys) {
+
+ Assert.assertTrue("Key " + expectedKey +
+ " was expected from file " + f,
+ detectedKeys.contains(expectedKey));
+ }
+
+ for (String expectedKey : notExpectedKeys) {
+
+ Assert.assertFalse("Key " + expectedKey +
+ " was NOT expected from file " + f,
+ detectedKeys.contains(expectedKey));
+ }
+ }
+
+ protected void parseBadLine(File f, String line, String... expectedKeys) throws IOException {
+ parser.parseLine(f, line);
+ for (String expectedKey : expectedKeys) {
+
+ Assert.assertFalse("Key " + expectedKey +
+ " was not expected from line " + line,
+ detectedKeys.contains(expectedKey));
+ }
+ }
}
Modified: trunk/nuiton-i18n/pom.xml
===================================================================
--- trunk/nuiton-i18n/pom.xml 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n/pom.xml 2014-02-03 11:39:42 UTC (rev 2016)
@@ -28,7 +28,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.5.3-SNAPSHOT</version>
+ <version>2.6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18n.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -46,7 +46,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.l_("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>
*
@@ -153,7 +153,7 @@
/**
* Sets the default locale used by I18n for the method
- * {@link I18n#_(String, Object...)}. *
+ * {@link I18n#t(String, Object...)}. *
* <p/>
* As a side effect, it will also set this locale is the default locale in
* the system (says the method {@link Locale#getDefault()} will return the
@@ -175,7 +175,7 @@
/**
* Obtain the default locale setted in I18n. This very locale is used in
* translation when no locale information is given
- * (says in method {@link I18n#_(String, Object...)}.
+ * (says in method {@link I18n#t(String, Object...)}.
* <p/>
* <b>Note :</b> The I18n system must have been initialized by one of the
* {@code init} method.
@@ -255,7 +255,7 @@
* sinon.
* @since 2.1
*/
- public static String l_(Locale locale, String message, Object... args) {
+ public static String l(Locale locale, String message, Object... args) {
checkInit();
@@ -286,7 +286,7 @@
} catch (Exception zzz) {
if (log.isWarnEnabled()) {
log.warn(
- _("nuitonutil.error.i18n.untranslated.message", message),
+ t("nuitonutil.error.i18n.untranslated.message", message),
zzz);
}
return applyFilter(message);
@@ -302,7 +302,7 @@
* @return la traduction si possible ou la chaine passee en parametre
* sinon.
*/
- public static String _(String message, Object... args) {
+ public static String t(String message, Object... args) {
// if the key to translate is null, just return null
if (message == null) {
@@ -313,7 +313,7 @@
Locale locale = getDefaultLocale();
// translate with this locale
- String result = l_(locale, message, args);
+ String result = l(locale, message, args);
return result;
}
@@ -325,7 +325,7 @@
* <p/>
* Par exemple :
* <pre>String key = "nuitonutils.key";
- * String result = l_(key)</pre>
+ * String result = l(key)</pre>
* fonctionnera, mais la chaine n'aura pas été marquée comme devant être
* internationalisé.
* <p/>
@@ -337,7 +337,7 @@
* @param args les parametres pour le message.
* @return le message passe en argument mais formatté avec les parametres
*/
- public static String n_(String message, Object... args) {
+ public static String n(String message, Object... args) {
if (args.length == 0) {
return message;
}
@@ -350,7 +350,7 @@
} catch (Exception eee) {
if (log.isWarnEnabled()) {
log.warn(
- _("nuitonutil.error.i18n.unformated.message", message, Arrays.toString(args)),
+ t("nuitonutil.error.i18n.unformated.message", message, Arrays.toString(args)),
eee);
}
return message;
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nBundleBridge.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nBundleBridge.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nBundleBridge.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -49,7 +49,7 @@
@Override
public Object handleGetObject(String key) {
- return I18n._(key);
+ return I18n.t(key);
}
}
Modified: trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java
===================================================================
--- trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n/src/main/java/org/nuiton/i18n/I18nStore.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -80,7 +80,7 @@
* Obtain the current language setted in the store.
* <p/>
* This language is used for all translations without locale information
- * (says the method {@link I18n#_(String, Object...)}).
+ * (says the method {@link I18n#t(String, Object...)}).
*
* @return the current language or {@code null} if none is defined
* @since 2.1
@@ -93,7 +93,7 @@
* Obtain the current locale setted in the store.
* <p/>
* This locale is coming from the current language and is used for all
- * translations without locale information (says the method {@link I18n#_(String, Object...)}.
+ * translations without locale information (says the method {@link I18n#t(String, Object...)}.
*
* @return the current locale or {@code null} if no current language is setted
* @since 2.1
Modified: trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java
===================================================================
--- trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n/src/test/java/org/nuiton/i18n/I18nTest.java 2014-02-03 11:39:42 UTC (rev 2016)
@@ -67,7 +67,7 @@
// pas de traduction possible car l'initialiser n'est pas bon :)
expected = "key.with.param";
- actual = I18n._("key.with.param");
+ actual = I18n.t("key.with.param");
Assert.assertEquals(expected, actual);
}
@@ -82,10 +82,10 @@
// pas de traduction possible car l'initialiser n'est pas bon :)
expected = "key.with.param";
- actual = I18n.l_(Locale.FRANCE, "key.with.param");
+ actual = I18n.l(Locale.FRANCE, "key.with.param");
Assert.assertEquals(expected, actual);
- actual = I18n.l_(Locale.UK, "key.with.param");
+ actual = I18n.l(Locale.UK, "key.with.param");
Assert.assertEquals(expected, actual);
}
@@ -112,7 +112,7 @@
I18n.init(initializer, Locale.JAPAN);
Assert.assertNotNull(I18n.store.resolver.getEncoding());
- Assert.assertEquals("最初の", I18n._("key.one"));
+ Assert.assertEquals("最初の", I18n.t("key.one"));
}
@Test
@@ -127,11 +127,11 @@
// I18n.getStore().setLanguage(Locale.FRANCE);
expected = "Clé avec %s";
- actual = I18n._("key.with.param");
+ actual = I18n.t("key.with.param");
Assert.assertEquals(expected, actual);
expected = "Clé avec param";
- actual = I18n._("key.with.param", "param");
+ actual = I18n.t("key.with.param", "param");
Assert.assertEquals(expected, actual);
// passage en anglais
@@ -140,11 +140,11 @@
// I18n.getStore().setLanguage(Locale.UK);
expected = "Key with %s";
- actual = I18n._("key.with.param");
+ actual = I18n.t("key.with.param");
Assert.assertEquals(expected, actual);
expected = "Key with param";
- actual = I18n._("key.with.param", "param");
+ actual = I18n.t("key.with.param", "param");
Assert.assertEquals(expected, actual);
// passage langue inconnue
@@ -153,11 +153,11 @@
// I18n.getStore().setLanguage(Locale.CHINA);
expected = "key.with.param";
- actual = I18n._("key.with.param");
+ actual = I18n.t("key.with.param");
Assert.assertEquals(expected, actual);
expected = "key.with.param";
- actual = I18n._("key.with.param", "param");
+ actual = I18n.t("key.with.param", "param");
Assert.assertEquals(expected, actual);
}
@@ -172,11 +172,11 @@
I18n.init(initializer, null);
expected = "Clé avec %s";
- actual = I18n.l_(Locale.FRANCE, "key.with.param");
+ actual = I18n.l(Locale.FRANCE, "key.with.param");
Assert.assertEquals(expected, actual);
expected = "Clé avec param";
- actual = I18n.l_(Locale.FRANCE, "key.with.param", "param");
+ actual = I18n.l(Locale.FRANCE, "key.with.param", "param");
Assert.assertEquals(expected, actual);
// en anglais
@@ -184,21 +184,21 @@
// I18n.getStore().setLanguage(Locale.UK);
expected = "Key with %s";
- actual = I18n.l_(Locale.UK, "key.with.param");
+ 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");
+ 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");
+ 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");
+ actual = I18n.l(Locale.CHINA, "key.with.param", "param");
Assert.assertEquals(expected, actual);
}
@@ -211,15 +211,15 @@
Date date = new GregorianCalendar(2011, 4, 5).getTime();
String expected = "Key with 05-May-2011";
- String actual = I18n.l_(Locale.UK, "key.with.date", date);
+ String actual = I18n.l(Locale.UK, "key.with.date", date);
Assert.assertEquals(expected, actual);
expected = "とキー 2011/05/05";
- actual = I18n.l_(Locale.JAPAN, "key.with.date", date);
+ actual = I18n.l(Locale.JAPAN, "key.with.date", date);
Assert.assertEquals(expected, actual);
expected = "Clé avec 5 mai 2011";
- actual = I18n.l_(Locale.FRANCE, "key.with.date", date);
+ actual = I18n.l(Locale.FRANCE, "key.with.date", date);
Assert.assertEquals(expected, actual);
}
@@ -232,7 +232,7 @@
I18n.init(initializer, Locale.FRANCE);
String key = "youhou";
- String text = I18n._(key);
+ String text = I18n.t(key);
Assert.assertNotNull(text);
Assert.assertEquals(key, text);
@@ -241,10 +241,10 @@
initializer.setMissingKeyReturnNull(true);
I18n.init(initializer, Locale.FRANCE);
- text = I18n._(key);
+ text = I18n.t(key);
Assert.assertNull(text);
- text = I18n._(key, 123);
+ text = I18n.t(key, 123);
Assert.assertNull(text);
}
Modified: trunk/nuiton-i18n-editor/pom.xml
===================================================================
--- trunk/nuiton-i18n-editor/pom.xml 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/pom.xml 2014-02-03 11:39:42 UTC (rev 2016)
@@ -32,7 +32,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>i18n</artifactId>
- <version>2.5.1-SNAPSHOT</version>
+ <version>2.6-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.i18n</groupId>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleCheckBoxMenuUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -28,7 +28,7 @@
java.util.Locale
jaxx.runtime.JAXXContext
-static org.nuiton.i18n.I18n._
+static t
</import>
<!-- le nom du bundle -->
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValueUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -29,7 +29,7 @@
org.nuiton.i18n.editor.I18nEditorContext
-static org.nuiton.i18n.I18n._
+static t
</import>
<!-- la locale -->
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/BundleValuesUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -35,7 +35,7 @@
org.nuiton.i18n.editor.project.I18nProject
org.nuiton.i18n.editor.project.AbstractI18nProject
-static org.nuiton.i18n.I18n._
+static t
</import>
<!-- les locales -->
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreateBundleUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -29,7 +29,7 @@
org.nuiton.i18n.editor.I18nEditorContext
-static org.nuiton.i18n.I18n._
+static t
</import>
<String id='bundle'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/CreatePackageUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -29,7 +29,7 @@
org.nuiton.i18n.editor.I18nEditorContext
-static org.nuiton.i18n.I18n._
+static t
</import>
<String id='bundle'/>
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/I18nEditorUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -46,7 +46,7 @@
javax.swing.tree.TreeNode
java.awt.Component
-static org.nuiton.i18n.I18n._
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/PackageCheckBoxMenuUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -31,7 +31,7 @@
java.util.Locale
jaxx.runtime.JAXXContext
-static org.nuiton.i18n.I18n._
+static t
</import>
<!-- le nom du bundle -->
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/ProjectUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -55,8 +55,8 @@
java.awt.event.MouseAdapter
java.awt.event.MouseEvent
-static org.nuiton.i18n.I18n.n_
-static org.nuiton.i18n.I18n._
+static n
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/AbstractProjectTabPanelUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -35,8 +35,8 @@
javax.swing.JLabel
java.awt.Color
-static org.nuiton.i18n.I18n.n_
-static org.nuiton.i18n.I18n._
+static n
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ChooseProjectTypePanelUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -39,7 +39,7 @@
java.awt.GridBagConstraints
java.awt.Insets
-static org.nuiton.i18n.I18n._
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ConfigureProjectPanelUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -32,7 +32,7 @@
org.nuiton.i18n.editor.project.I18nProjectFactory
org.nuiton.i18n.editor.project.I18nProjectConfigurePanelUI
-static org.nuiton.i18n.I18n._
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/PersistPanelUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -37,7 +37,7 @@
java.io.File
-static org.nuiton.i18n.I18n._
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/ResumePanelUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -31,7 +31,7 @@
javax.swing.JLabel
-static org.nuiton.i18n.I18n._
+static t
</import>
<script><![CDATA[
Modified: trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx
===================================================================
--- trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/nuiton-i18n-editor/src/main/java/org/nuiton/i18n/editor/ui/project/tabs/SelectBundlesPanelUI.jaxx 2014-02-03 11:39:42 UTC (rev 2016)
@@ -31,7 +31,7 @@
org.nuiton.i18n.editor.ui.project.ProjectStep
org.nuiton.i18n.editor.ui.project.SelectBundlesTableModel
-static org.nuiton.i18n.I18n._
+static t
</import>
<script><![CDATA[
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/pom.xml 2014-02-03 11:39:42 UTC (rev 2016)
@@ -31,11 +31,11 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>4.0</version>
+ <version>4.6</version>
</parent>
<artifactId>i18n</artifactId>
- <version>2.5.3-SNAPSHOT</version>
+ <version>2.6-SNAPSHOT</version>
<packaging>pom</packaging>
<name>I18n</name>
<description>Nuiton i18n tools</description>
@@ -102,6 +102,12 @@
<version>2.1</version>
</dependency>
+ <dependency>
+ <groupId>com.google.code.javaparser</groupId>
+ <artifactId>javaparser</artifactId>
+ <version>1.0.8</version>
+ </dependency>
+
<!-- provided dependencies -->
<dependency>
<groupId>org.apache.maven</groupId>
Modified: trunk/src/site/apt/helloWorld.apt
===================================================================
--- trunk/src/site/apt/helloWorld.apt 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/src/site/apt/helloWorld.apt 2014-02-03 11:39:42 UTC (rev 2016)
@@ -37,8 +37,8 @@
La classe java correspondante ressemble à ça :
----------------------------------------------------------------------------
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.t;
+import static org.nuiton.i18n.I18n.n;
class HelloWorld {
Modified: trunk/src/site/apt/library.apt.vm
===================================================================
--- trunk/src/site/apt/library.apt.vm 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/src/site/apt/library.apt.vm 2014-02-03 11:39:42 UTC (rev 2016)
@@ -181,7 +181,7 @@
-------------------------------------------------------------------------------
package org.myOrganisation.myLibrary;
-import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.t;
public class myLibrary {
Modified: trunk/src/site/en/apt/helloWorld.apt
===================================================================
--- trunk/src/site/en/apt/helloWorld.apt 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/src/site/en/apt/helloWorld.apt 2014-02-03 11:39:42 UTC (rev 2016)
@@ -36,8 +36,8 @@
The corresponding java class looks like this :
----------------------------------------------------------------------------
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
+import static org.nuiton.i18n.I18n.t;
+import static org.nuiton.i18n.I18n.n;
class HelloWorld {
Modified: trunk/src/site/en/apt/library.apt.vm
===================================================================
--- trunk/src/site/en/apt/library.apt.vm 2014-02-03 11:38:28 UTC (rev 2015)
+++ trunk/src/site/en/apt/library.apt.vm 2014-02-03 11:39:42 UTC (rev 2016)
@@ -180,7 +180,7 @@
-------------------------------------------------------------------------------
package org.myOrganisation.myLibrary;
-import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.t;
public class myLibrary {
1
0
r2015 - trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl
by tchemit@users.nuiton.org 03 Feb '14
by tchemit@users.nuiton.org 03 Feb '14
03 Feb '14
Author: tchemit
Date: 2014-02-03 12:38:28 +0100 (Mon, 03 Feb 2014)
New Revision: 2015
Url: http://nuiton.org/projects/i18n/repository/revisions/2015
Log:
fixes #3020: Remove deprecated parser (jsp and tapestry)
Removed:
trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java
trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java
Deleted: trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java
===================================================================
--- trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java 2013-08-09 09:04:00 UTC (rev 2014)
+++ trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserJspMojo.java 2014-02-03 11:38:28 UTC (rev 2015)
@@ -1,317 +0,0 @@
-/*
- * #%L
- * I18n :: Maven Plugin
- *
- * $Id$
- * $HeadURL$
- * %%
- * 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
- * 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.lang3.StringUtils;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.nuiton.i18n.plugin.parser.I18nSourceEntry;
-import org.nuiton.i18n.plugin.parser.SourceEntry;
-import org.nuiton.io.FileUpdater;
-import org.nuiton.io.MirroredFileUpdater;
-import org.nuiton.plugin.PluginHelper;
-import org.nuiton.processor.ProcessorUtil;
-import org.nuiton.processor.filters.DefaultFilter;
-import org.nuiton.processor.filters.Filter;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.xpath.XPath;
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Find i18n keys from jsp files.
- * <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 tchemit <chemit(a)codelutin.com>
- * @since 2.0
- * @deprecated since 2.5, hard to maintain jsp as valid xml docs. Will be removed soon
- */
-@Mojo(name = "parserJsp", defaultPhase = LifecyclePhase.GENERATE_RESOURCES)
-public class ParserJspMojo extends AbstractParserXmlMojo {
-
- public static final String DEFAULT_INCLUDES = "**/*.jsp";
-
- /**
- * Root directory of the default entry.
- *
- * @since 2.0
- */
- @Parameter(property = "i18n.defaultBasedir", defaultValue = "${basedir}/src/main/webapp", required = true)
- protected File defaultBasedir;
-
- /**
- * Default included files to process (ant-like expression).
- * <p/>
- * <strong>Note:</strong> default value is **\/*.jsp
- *
- * @since 2.0
- */
- @Parameter(property = "i18n.defaultIncludes", defaultValue = DEFAULT_INCLUDES, required = true)
- protected String defaultIncludes;
-
- /**
- * Defines the core rules file used to detect i18n keys in jsp files.
- * <p/>
- * <b>Note :</b> If you do not want to use it, set it to empty and fill the
- * {@link #userRulesFiles} parameter.
- *
- * @since 2.0
- */
- @Parameter(property = "i18n.coreRuleFile")
- protected String coreRuleFile;
-
- /**
- * Defines the file name of the getter where to put detected i18n keys
- * while getter phase.
- *
- * @since 2.0
- */
- @Parameter(property = "i18n.outputGetter", defaultValue = "jsp.getter", required = true)
- protected String outputGetter;
-
- /**
- * Where to generated temporary processed files.
- *
- * @since 2.0
- */
- @Parameter(property = "i18n.workdir", defaultValue = "${basedir}/target/i18n-workdir", required = true)
- protected File workdir;
-
- @Override
- public String[] getDefaultIncludes() {
- return new String[]{defaultIncludes};
- }
-
- @Override
- public String[] getDefaultExcludes() {
- return I18nSourceEntry.EMPTY_STRING_ARRAY;
- }
-
- @Override
- public File getDefaultBasedir() {
- return defaultBasedir;
- }
-
- MirroredFileUpdater entryUpdater;
-
- @Override
- protected boolean onEnterEntry(I18nSourceEntry entry) {
- boolean b = super.onEnterEntry(entry);
- if (!b) {
-
- // no skipped entry
- // keep the file updater
- entryUpdater = (MirroredFileUpdater) entry.getUpdater();
- }
- return b;
- }
-
- @Override
- public FileUpdater newFileUpdater(SourceEntry entry) {
- return new MirroredFileUpdater("", "", entry.getBasedir(), workdir) {
-
- @Override
- public File getMirrorFile(File f) {
- String file =
- f.getAbsolutePath().substring(prefixSourceDirecotory);
- return new File(destinationDirectory + File.separator + file + "~");
- }
- };
- }
-
- @Override
- protected String getOutGetter() {
- return outputGetter;
- }
-
- @Override
- protected String getCoreRuleFile() {
- return coreRuleFile;
- }
-
- protected XmlFileParser newXmlFileParser(final XPath xpath,
- final DocumentBuilder builder) {
-
- return new XmlFileParser(getLog(),
- encoding,
- oldParser,
- acceptPattern,
- showTouchedFiles,
- rules,
- xpath,
- builder,
- namespaces,
- isVerbose()) {
-
- @Override
- public File prepareFile(File file) throws IOException {
-
- // clean the jsp to make it xml
-
- File result = entryUpdater.getMirrorFile(file);
- createDirectoryIfNecessary(result.getParentFile());
- JspFileProcessor processor = new JspFileProcessor();
- processor.process(file, result, getEncoding());
- String resultFileContent =
- PluginHelper.readAsString(result, getEncoding());
- resultFileContent = resultFileContent.trim();
-
- if (StringUtils.isBlank(resultFileContent)) {
-
- // nothing to scan inside this file
- result = null;
- } else {
-
- if (resultFileContent.startsWith("<html") ||
- resultFileContent.startsWith("<HTML") ||
- resultFileContent.startsWith("<?xml")
- ) {
-
- // document should be well-formed...
-
- } else {
- // to be sure, document is well formed, add a start and end tag
- resultFileContent = "<div>\n" + resultFileContent + "\n</div>";
-
- PluginHelper.writeString(result, resultFileContent, getEncoding());
- }
-
- }
-
- return result;
- }
-
- @Override
- public String extract(String i18nString) {
- String s = null;
- if (!StringUtils.isEmpty(i18nString.trim())) {
- s = i18nString.trim();
- }
- if (getLog().isDebugEnabled()) {
- getLog().debug(i18nString + " = " + s);
- }
- return s;
- }
-
- };
- }
-
- /**
- * To transform jsp files to valid xml files.
- * <p/>
- * Says :
- * <ul>
- * <li>Remove jsp directive</li>
- * <li>Remove jsp comment</li>
- * <li>Remove any tags in attributes (used for example in struts)</li>
- * <li>? Other thing</li>
- * </ul>
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
- public static class JspFileProcessor extends ProcessorHelper.AbstractParserProcessor {
-
- protected ProcessorHelper.FragmentRemover remover1 =
- new ProcessorHelper.FragmentRemover(
- "<" + "%" + "-" + "-",
- "-" + "-" + "%" + ">"
- );
-
- protected ProcessorHelper.FragmentRemover remover2 =
- new ProcessorHelper.FragmentRemover(
- "<" + "%",
- "%" + ">"
- );
-
- protected ProcessorHelper.FragmentRemover remover3 =
- new ProcessorHelper.FragmentRemover(
- "<" + "!" + "-" + "-",
- "-" + "-" + ">"
- );
-
- public JspFileProcessor() {
- setInputFilter(
- new Filter[]{
- remover1,
- remover2,
- remover3,
- new JspAttributeWithTagFilter()
- }
- );
- }
-
- /**
- * @param filein the source file to process
- * @param fileout the output file to generate
- * @param encoding encoding used to read and write files
- * @throws IOException if any io problems while processing
- * @since 1.0.4
- */
- @Override
- public void process(File filein,
- File fileout,
- String encoding) throws IOException {
- ProcessorUtil.doProcess(this, filein, fileout, encoding);
- }
-
- /**
- * To remove in attributes any sub tags inside it (used for example in
- * struts) from jsp files.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.0
- */
- public static class JspAttributeWithTagFilter extends DefaultFilter {
-
- private String header = "=" + "\"" + "<";
-
- private String footer = "\"" + "/" + ">" + "\"";
-
- @Override
- protected String performInFilter(String ch) {
- return "=\"\"";
- }
-
- @Override
- protected String performOutFilter(String ch) {
- return ch;
- }
-
- protected String getHeader() {
- return header;
- }
-
- protected String getFooter() {
- return footer;
- }
- }
- }
-}
Deleted: trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java
===================================================================
--- trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java 2013-08-09 09:04:00 UTC (rev 2014)
+++ trunk/i18n-maven-plugin/src/main/java/org/nuiton/i18n/plugin/parser/impl/ParserTapestryMojo.java 2014-02-03 11:38:28 UTC (rev 2015)
@@ -1,299 +0,0 @@
-/*
- * #%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;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.nuiton.i18n.plugin.parser.AbstractFileParser;
-import org.nuiton.i18n.plugin.parser.AbstractI18nParserMojo;
-import org.nuiton.i18n.plugin.parser.FileParser;
-import org.nuiton.i18n.plugin.parser.I18nSourceEntry;
-import org.nuiton.i18n.plugin.parser.ParserException;
-import org.nuiton.i18n.plugin.parser.SourceEntry;
-import org.nuiton.io.FileUpdater;
-import org.nuiton.io.MirroredFileUpdater;
-import org.nuiton.io.SortedProperties;
-import org.nuiton.processor.ProcessorUtil;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Pattern;
-
-/**
- * To parse Tapestry templates to detect new I18n keys, says content of patterns :
- * {@code ${message:XXX}} and {@code ${format:XXX=...}}.
- * <p/>
- * <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 tchemit <chemit(a)codelutin.com>
- * @since 2.1
- * @deprecated since 2.5, Not very usefull, since not very efficient, will be removed soon.
- */
-@Mojo(name = "parserTapestry", defaultPhase = LifecyclePhase.GENERATE_RESOURCES)
-public class ParserTapestryMojo extends AbstractI18nParserMojo {
-
- public static final String DEFAULT_INCLUDES = "**/*.tml";
-
- /**
- * Root directory of the default entry.
- *
- * @since 2.1
- */
- @Parameter(property = "i18n.defaultBasedir", defaultValue = "${basedir}/src/main/webapp", required = true)
- protected File defaultBasedir;
-
- /**
- * Default included files to process (ant-like expression).
- * <p/>
- * <strong>Note:</strong> default value is **\/*.tml
- *
- * @since 2.1
- */
- @Parameter(property = "i18n.defaultIncludes", defaultValue = DEFAULT_INCLUDES, required = true)
- protected String defaultIncludes;
-
- /**
- * Defines the file name of the getter where to put detected i18n keys
- * while getter phase.
- *
- * @since 2.1
- */
- @Parameter(property = "i18n.outputGetter", defaultValue = "tapestry.getter", required = true)
- protected String outputGetter;
-
- /**
- * Where to generated temporary processed files.
- *
- * @since 2.1
- */
- @Parameter(property = "i18n.workdir", defaultValue = "${basedir}/target/i18n-workdir")
- protected File workdir;
-
- protected MirroredFileUpdater entryUpdater;
-
- @Override
- public String[] getDefaultIncludes() {
- return new String[]{defaultIncludes};
- }
-
- @Override
- public String[] getDefaultExcludes() {
- return I18nSourceEntry.EMPTY_STRING_ARRAY;
- }
-
- @Override
- public File getDefaultBasedir() {
- return defaultBasedir;
- }
-
- @Override
- protected boolean onEnterEntry(I18nSourceEntry entry) {
- boolean b = super.onEnterEntry(entry);
- if (!b) {
-
- // no skipped entry
- // keep the file updater
- entryUpdater = (MirroredFileUpdater) entry.getUpdater();
- }
- return b;
- }
-
- @Override
- public FileUpdater newFileUpdater(SourceEntry entry) {
- return new MirroredFileUpdater("", "", entry.getBasedir(), workdir) {
-
- @Override
- public File getMirrorFile(File f) {
- String file =
- f.getAbsolutePath().substring(prefixSourceDirecotory);
- return new File(destinationDirectory + File.separator + file);
- }
- };
- }
-
- @Override
- protected String getOutGetter() {
- return outputGetter;
- }
-
- @Override
- public FileParser newFileParser(Pattern acceptPattern) {
-
- return new TapestryFileParser(getLog(),
- encoding,
- oldParser,
- acceptPattern,
- isShowTouchedFiles()
- );
- }
-
- protected class TapestryFileParser extends AbstractFileParser {
-
-
- public TapestryFileParser(Log log,
- String encoding,
- SortedProperties oldParser,
- Pattern acceptKeyPattern,
- boolean showTouchedFiles) {
- super(log, encoding, oldParser, acceptKeyPattern, showTouchedFiles);
- }
-
-
- protected File prepareFile(File file) throws IOException {
-
- // clean the jsp to make it xml
-
- File result = entryUpdater.getMirrorFile(file);
- if (isVerbose()) {
- getLog().info("Will process [" + file + "] to " + result);
- }
- try {
- createDirectoryIfNecessary(result.getParentFile());
- } catch (IOException e) {
- // don't care about it...
- }
- TapestryFileProcessor processor = new TapestryFileProcessor();
- processor.setVerbose(isVerbose());
- processor.process(file, result, getEncoding());
- return result;
- }
-
- @Override
- public void parseFile(File file) throws IOException {
-
- // clean the jsp to make it xml
-
- File processedFile = prepareFile(file);
-
- // process file to obtain
- String line = null;
- LineNumberReader lnr = new LineNumberReader(new InputStreamReader(
- new FileInputStream(processedFile), getEncoding()));
- try {
- while ((line = lnr.readLine()) != null) {
- parseLine(processedFile, line);
- }
- } catch (Exception e) {
- if (line != null) {
- getLog().error(
- "could not parse line (" + lnr.getLineNumber() + ") '"
- + line + "' of file " + file);
- }
- throw new ParserException(e);
- } finally {
- lnr.close();
- }
- }
-
- @Override
- public void parseLine(File file, String line) throws IOException {
-
- String key = line.trim();
-
- if (key.isEmpty()) {
- // no key detected on this line
- return;
- }
-
-// // one key found in file, so file is marked as touched
-// setTouched(true);
- // Found a i18n key, register it.
- if (getLog().isDebugEnabled()) {
- getLog().debug(file.getName() + " detected key = " + key);
- }
- registerKey(key);
- }
- }
-
- /**
- * To Extract i18n keys from tapestry template files.
- * <p/>
- * Says :
- * <ul>
- * <li>Remove all xml comments</li>
- * <li>Keep content of {@code ${message:XXX}}</li>
- * <li>Keep content of {@code ${format:XXX}}}</li>
- * </ul>
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 2.1
- */
- public static class TapestryFileProcessor extends ProcessorHelper.AbstractParserProcessor {
-
- protected ProcessorHelper.FragmentRemover remover1 =
- new ProcessorHelper.FragmentRemover(
- "<" + "!" + "-" + "-",
- "-" + "-" + ">"
- );
-
- protected ProcessorUtil.FragmentExtractor extractor1 =
- new ProcessorUtil.FragmentExtractor(
- "$" + "{" + "m" + "e" + "s" + "s" + "a" + "g" + "e" + ":",
- "}"
- );
-
- protected ProcessorUtil.FragmentExtractor extractor2 =
- new ProcessorUtil.FragmentExtractor(
- "$" + "{" + "f" + "o" + "r" + "m" + "a" + "t" + ":",
- "}") {
-
- @Override
- protected String performInFilter(String ch) {
- int i = ch.indexOf('=');
- if (verbose) {
- log.info("Detected key " + ch);
- }
- if (i == -1) {
- return "";
- }
- return ch.substring(0, i) + "\n";
- }
- };
-
-
- public void process(File filein,
- File fileout,
- String encoding) throws IOException {
-
- // remove comment fragments
- File fileTemp = new File(fileout.getAbsolutePath() + "-no-comment");
- removefragments(remover1, filein, fileTemp, encoding, false);
-
- Set<String> keys = new HashSet<String>();
- extractKeys(extractor1, fileTemp, encoding, verbose, keys);
- extractKeys(extractor2, fileTemp, encoding, verbose, keys);
- saveKeysToFile(fileout, keys);
- }
- }
-}
1
0