This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See http://git.nuiton.org/jaxx.git commit 0dcfa4e82a7a9ee5e16ae1290ad3c3cf624c2f2a Author: Tony CHEMIT <chemit@codelutin.com> Date: Sun Aug 24 14:47:29 2014 +0200 fixes #3470: Improve the I18n detection --- .../src/main/java/jaxx/compiler/I18nHelper.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java index 34859b5..4ab922d 100644 --- a/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java +++ b/jaxx-compiler/src/main/java/jaxx/compiler/I18nHelper.java @@ -23,6 +23,7 @@ package jaxx.compiler; import jaxx.runtime.SwingUtil; +import org.apache.commons.lang3.CharUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.i18n.I18n; @@ -84,8 +85,26 @@ public class I18nHelper { if (log.isDebugEnabled()) { log.debug(" try i18n support for [" + widgetId + ":" + attributeName + "] : " + attributeValueCode); } - //FIXME-tchemit-2014-05-14 Should improve this, the i18n detection is not ok. - if (!attributeValueCode.contains("t()") && attributeValueCode.contains("t(") && attributeValueCode.contains(")") && !attributeValueCode.contains(",")) { + boolean doWarn = false; + int indexOf = attributeValueCode.indexOf("t("); + if (indexOf > -1 && !attributeValueCode.contains(",")) { + if (indexOf == 0) { + doWarn = true; + } else { + + // make sure that the previous character is not alphabetical (means yet another method than t()) + char charBefore = attributeValueCode.charAt(indexOf - 1); + if (CharUtils.isAsciiAlphanumeric(charBefore)) { + + doWarn = false; + } else { + + //TODO tchemit-2014-08-24 Maybe could we do better ? + doWarn = true; + } + } + } + if (doWarn) { compiler.reportWarning("\n\tjaxx supports i18n, no need to add explicit call to I18n.t for attribute '" + attributeName + "' in component '" + widgetId + "' : [" + attributeValueCode + "]"); } else { compiler.addImport("static " + I18n.class.getName() + ".t"); -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.