Package com.google.sitebricks.i18n

Examples of com.google.sitebricks.i18n.Message.message()


      check(null != message,
          "Found an i18n interface method missing @Message annotation: ", iface, method);

      if (null != message) {
        check(!Strings.empty(message.message()),
            "Empty @Message annotation is not allowed ", iface, method);
      }

      String template = localization.messageBundle.get(method.getName());
      check(null != template,
View Full Code Here


      List<Token> tokens = null;
      try {
        MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(arguments);

        // Compile both the default message as well as the provided localized one.
        Parsing.tokenize(message.message(), compiler);
        tokens = Parsing.tokenize(template, compiler);
      } catch (ExpressionCompileException e) {
        check(false, "Compile error in i18n message template: \n  " + e.getError().getError() +
            " in expression " + e.getError().getExpression() +"\n\n  ...in: ", iface, method);
      }
View Full Code Here

    Map<String, String> defaultMessages = Maps.newHashMap();

    for (Method method : iface.getMethods()) {
      Message msg = method.getAnnotation(Message.class);
      if (null != msg) {
        defaultMessages.put(method.getName(), msg.message());
      }
    }

    return new Localization(iface, Locale.getDefault(), defaultMessages);
  }
View Full Code Here

      check(null != message,
          "Found an i18n interface method missing @Message annotation: ", iface, method);

      if (null != message) {
        check(!Strings.empty(message.message()),
            "Empty @Message annotation is not allowed ", iface, method);
      }

      String template = localization.messageBundle.get(method.getName());
      check(null != template,
View Full Code Here

      List<Token> tokens = null;
      try {
        MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler(arguments);

        // Compile both the default message as well as the provided localized one.
        Parsing.tokenize(message.message(), compiler);
        tokens = Parsing.tokenize(template, compiler);
      } catch (ExpressionCompileException e) {
        check(false, "Compile error in i18n message template: \n  " + e.getError().getError() +
            " in expression " + e.getError().getExpression() +"\n\n  ...in: ", iface, method);
      }
View Full Code Here

    Map<String, String> defaultMessages = Maps.newHashMap();

    for (Method method : iface.getMethods()) {
      Message msg = method.getAnnotation(Message.class);
      if (null != msg) {
        defaultMessages.put(method.getName(), msg.message());
      }
    }

    return new Localization(iface, Locale.getDefault(), defaultMessages);
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.