Package com.google.gwt.i18n.client.Messages

Examples of com.google.gwt.i18n.client.Messages.AlternateMessage


  public GenericMessages(Class<?> _itf, String lang) throws IOException, InvalidParameterException {
    super(_itf, lang);
  }

  private String buildMessage(String propertyName, Method method, Object[] argsthrows Throwable {
    AlternateMessage pluralTextAnnotation = method.getAnnotation(AlternateMessage.class);
    Map<Integer, String> pluralParamIndex2pattern = new HashMap<Integer, String>();
    String pluralKey =""; //$NON-NLS-1$
    Map<String,String> pluralKey2defaultValue = new HashMap<String,String>();
    if (pluralTextAnnotation != null) {
      String[] pairs = pluralTextAnnotation.value();
      for(int i=0; (i+1)<pairs.length; i+=2) {
        pluralKey2defaultValue.put(pairs[i], pairs[i+1]);
      }
    }
    Annotation[][] paramsAnnotations = method.getParameterAnnotations();
View Full Code Here


        }
        for (int i = 0; i + 1 < pluralForms.length; i += 2) {
          entry.addAlternateText(pluralForms[i], pluralForms[i + 1]);
        }
      }
      AlternateMessage altMsg = method.getAnnotation(AlternateMessage.class);
      if (altMsg != null) {
        if (pluralText != null) {
          throw new AnnotationsError("May not have both @AlternateMessage"
              + " and @PluralText");
        }
        String[] altForms = altMsg.value();
        if ((altForms.length & 1) != 0) {
          throw new AnnotationsError(
              "Odd number of strings supplied to @AlternateMessage: must be"
              + " pairs of values and messages");
        }
View Full Code Here

   * Get the alternate message forms from either an AlternateMessages annotation
   * or a PluralText annotation.
   */
  @SuppressWarnings("deprecation")
  protected String[] getAlternateMessages() {
    AlternateMessage altMsgAnnot = getAnnotation(AlternateMessage.class);
    if (altMsgAnnot != null) {
      return altMsgAnnot.value();
    }
    // avoid deprecation warning for the import
    com.google.gwt.i18n.client.Messages.PluralText pluralTextAnnot
        = getAnnotation(com.google.gwt.i18n.client.Messages.PluralText.class);
    if (pluralTextAnnot != null) {
View Full Code Here

        return retVal;
    }
   
    private Map<String, String> buildAlternateMessageMap(String baseName, Method method) {
        Map<String, String> retMap = new LinkedHashMap<String, String>();
        AlternateMessage altMsgAnnotation = method.getAnnotation(AlternateMessage.class);
        PluralText pluralTextAnnotation = method.getAnnotation(PluralText.class);
        String[] values = new String[0];
        if(altMsgAnnotation != null) {
            values = altMsgAnnotation.value();
        } else if(pluralTextAnnotation != null) {
            // Fall back on the PluralText if no AlternateMessage found.
            values = pluralTextAnnotation.value();
        }
        for(int i = 0; i < values.length; i += 2) {
View Full Code Here

        }
        for (int i = 0; i + 1 < pluralForms.length; i += 2) {
          entry.addAlternateText(pluralForms[i], pluralForms[i + 1]);
        }
      }
      AlternateMessage altMsg = method.getAnnotation(AlternateMessage.class);
      if (altMsg != null) {
        if (pluralText != null) {
          throw new AnnotationsError("May not have both @AlternateMessage"
              + " and @PluralText");
        }
        String[] altForms = altMsg.value();
        if ((altForms.length & 1) != 0) {
          throw new AnnotationsError(
              "Odd number of strings supplied to @AlternateMessage: must be"
              + " pairs of values and messages");
        }
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.Messages.AlternateMessage

Copyright © 2018 www.massapicom. 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.