Package com.google.gwt.i18n.client.LocalizableResource

Examples of com.google.gwt.i18n.client.LocalizableResource.DefaultLocale


  private AlternateMessageSelector computeAlternateMessageSelector() {
    PluralCount pluralAnnot = getAnnotation(PluralCount.class);
    if (pluralAnnot != null) {
      Class<? extends PluralRule> pluralClass = pluralAnnot.value();
      // TODO(jat): this seems redundant with other processing
      DefaultLocale defLocaleAnnot = getAnnotation(
          DefaultLocale.class);
      String defaultLocale = null;
      if (defLocaleAnnot != null) {
        defaultLocale = defLocaleAnnot.value();
      } else {
        defaultLocale = DefaultLocale.DEFAULT_LOCALE;
      }
      PluralRule pluralRule = getLocalizedPluralRule(pluralClass,
          localeFactory.fromString(defaultLocale));
View Full Code Here


        if (underscore >= 0) {
          defLocaleValue = className.substring(underscore + 1);
        }

        // If there is an annotation declaring the default locale, use that
        DefaultLocale defLocaleAnnot = getClassAnnotation(clazz,
            DefaultLocale.class);
        if (defLocaleAnnot != null) {
          defLocaleValue = defLocaleAnnot.value();
        }
        GwtLocale defLocale = LocaleUtils.getLocaleFactory().fromString(
            defLocaleValue);
        if (!defLocale.isDefault()) {
          key = new ClassLocale(clazz, defLocale);
View Full Code Here

  public AnnotationsResource(TreeLogger logger, JClassType clazz,
      String locale, boolean isConstants) throws AnnotationsError {
    KeyGenerator keyGenerator = getKeyGenerator(clazz);
    map = new HashMap<String, MethodEntry>();
    setPath(clazz.getQualifiedSourceName());
    DefaultLocale defLocale = getClassAnnotation(clazz, DefaultLocale.class);
    if (defLocale != null && !ResourceFactory.DEFAULT_TOKEN.equals(locale)
        && !locale.equalsIgnoreCase(defLocale.value())) {
      logger.log(TreeLogger.WARN, "@DefaultLocale on "
          + clazz.getQualifiedSourceName() + " doesn't match " + locale)
      return;
    }
    for (JMethod method : clazz.getMethods()) {
View Full Code Here

  public void testAccept() throws MessageProcessingException {
    msgIntf.accept(new TestMessageInterfaceVisitor());
  }

  public void testGetAnnotation() {
    DefaultLocale defLocale = msgIntf.getAnnotation(DefaultLocale.class);
    assertNotNull(defLocale);
    assertEquals("en-US", defLocale.value());
    GenerateKeys generate = msgIntf.getAnnotation(GenerateKeys.class);
    assertNotNull(generate);
    assertEquals(MD5KeyGenerator.class.getName(), generate.value());
    assertNull(msgIntf.getAnnotation(Documented.class));
  }
View Full Code Here

  public AnnotationsResource(TreeLogger logger, JClassType clazz,
      String locale, boolean isConstants) throws AnnotationsError {
    KeyGenerator keyGenerator = getKeyGenerator(clazz);
    map = new HashMap<String, MethodEntry>();
    setPath(clazz.getQualifiedSourceName());
    DefaultLocale defLocale = clazz.getAnnotation(DefaultLocale.class);
    if (defLocale != null && !ResourceFactory.DEFAULT_TOKEN.equals(locale)
        && !locale.equalsIgnoreCase(defLocale.value())) {
      logger.log(TreeLogger.WARN, "@DefaultLocale on "
          + clazz.getQualifiedSourceName() + " doesn't match " + locale)
      return;
    }
    for (JMethod method : clazz.getMethods()) {
View Full Code Here

        if (underscore >= 0) {
          defLocaleValue = className.substring(underscore + 1);
        }

        // If there is an annotation declaring the default locale, use that
        DefaultLocale defLocaleAnnot = getClassAnnotation(clazz,
            DefaultLocale.class);
        if (defLocaleAnnot != null) {
          defLocaleValue = defLocaleAnnot.value();
        }
        GwtLocale defLocale = LocaleUtils.getLocaleFactory().fromString(
            defLocaleValue);
        if (!defLocale.isDefault()) {
          key = new ClassLocale(clazz, defLocale);
View Full Code Here

   protected Locale getLocale() {
      if (GwtConfig.get().getModuleRunner().getLocale() != null) {
         return GwtConfig.get().getModuleRunner().getLocale();
      }

      DefaultLocale annotation = GwtReflectionUtils.getAnnotation(proxiedClass, DefaultLocale.class);
      if (annotation != null) {
         String[] localeCodes = annotation.value().split("_");
         switch (localeCodes.length) {
            case 1:
               return new Locale(localeCodes[0]);
            case 2:
               return new Locale(localeCodes[0], localeCodes[1]);
            default:
               throw new GwtTestI18NException("Cannot parse Locale value in annoted class ["
                        + proxiedClass.getSimpleName() + "] : @"
                        + DefaultLocale.class.getSimpleName() + "(" + annotation.value() + ")");
         }
      } else {
         return null;
      }
   }
View Full Code Here

    if (underscore >= 0) {
      defLocaleValue = className.substring(underscore + 1);
    }
   
    // If there is an annotation declaring the default locale, use that
    DefaultLocale defLocaleAnnot = getClassAnnotation(clazz,
        DefaultLocale.class);
    if (defLocaleAnnot != null) {
      defLocaleValue = defLocaleAnnot.value();
    }
    GwtLocale defLocale = LocaleUtils.getLocaleFactory().fromString(
        defLocaleValue);
    if (!locale.isDefault() && !locale.equals(defLocale)) {
      logger.log(TreeLogger.WARN, "Default locale " + defLocale + " on "
View Full Code Here

  private AlternateMessageSelector computeAlternateMessageSelector() {
    PluralCount pluralAnnot = getAnnotation(PluralCount.class);
    if (pluralAnnot != null) {
      Class<? extends PluralRule> pluralClass = pluralAnnot.value();
      // TODO(jat): this seems redundant with other processing
      DefaultLocale defLocaleAnnot = getAnnotation(
          DefaultLocale.class);
      String defaultLocale = null;
      if (defLocaleAnnot != null) {
        defaultLocale = defLocaleAnnot.value();
      } else {
        defaultLocale = DefaultLocale.DEFAULT_LOCALE;
      }
      PluralRule pluralRule = getLocalizedPluralRule(pluralClass,
          localeFactory.fromString(defaultLocale));
View Full Code Here

    }
    return null;
  }

  protected GwtLocale getDefaultLocale() {
    DefaultLocale defLocaleAnnot = getAnnotation(DefaultLocale.class);
    String defLocale = defLocaleAnnot != null ? defLocaleAnnot.value()
        : DefaultLocale.DEFAULT_LOCALE;
    return localeFactory.fromString(defLocale);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.LocalizableResource.DefaultLocale

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.