Package com.google.gwt.i18n.client

Examples of com.google.gwt.i18n.client.PluralRule$PluralForm


      }
    } else {
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      PluralRule rule = createLocalizedPluralRule(logger,
          m.getEnclosingType().getOracle(), ruleClass, locale);
      logger.log(TreeLogger.TRACE, "Using plural rule " + rule.getClass()
          + " for locale '" + locale + "'", null);
      generated.append(PluralRule.class.getCanonicalName());
      generated.append(" rule = new " + rule.getClass().getCanonicalName()
          + "();\n");
      generated.append("switch (rule.select(arg" + pluralParamIndex + ")) {\n");
      PluralForm[] pluralForms = rule.pluralForms();
      resourceList.setPluralForms(key, pluralForms);
      // Skip default plural form (index 0); the fall-through case will handle
      // it.
      for (int i = 1; i < pluralForms.length; ++i) {
        String template = resourceList.getStringExt(key,
View Full Code Here


      }
    } else {
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      PluralRule rule = createLocalizedPluralRule(logger,
          m.getEnclosingType().getOracle(), ruleClass, locale);
      logger.log(TreeLogger.TRACE, "Using plural rule " + rule.getClass()
          + " for locale '" + locale + "'", null);
      generated.append(PluralRule.class.getCanonicalName());
      generated.append(" rule = new " + rule.getClass().getCanonicalName()
          + "();\n");
      generated.append("switch (rule.select(arg" + pluralParamIndex + ")) {\n");
      PluralForm[] pluralForms = rule.pluralForms();
      resourceList.setPluralForms(key, pluralForms);
      // Skip default plural form (index 0); the fall-through case will handle
      // it.
      for (int i = 1; i < pluralForms.length; ++i) {
        String template = resourceList.getStringExt(key,
View Full Code Here

      if (defLocaleAnnot != null) {
        defaultLocale = defLocaleAnnot.value();
      } else {
        defaultLocale = DefaultLocale.DEFAULT_LOCALE;
      }
      PluralRule pluralRule = getLocalizedPluralRule(pluralClass,
          localeFactory.fromString(defaultLocale));
      return new PluralRuleAdapter(pluralRule);
    }
    Select selectAnnot = getAnnotation(Select.class);
    if (selectAnnot != null) {
View Full Code Here

      }
    } else {
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      PluralRule rule = createLocalizedPluralRule(logger,
          m.getEnclosingType().getOracle(), ruleClass, locale);
      logger.log(TreeLogger.TRACE, "Using plural rule " + rule.getClass()
          + " for locale '" + locale + "'", null);
      generated.append(PluralRule.class.getCanonicalName());
      generated.append(" rule = new " + rule.getClass().getCanonicalName()
          + "();\n");
      generated.append("switch (rule.select(arg" + pluralParamIndex + ")) {\n");
      PluralForm[] pluralForms = rule.pluralForms();
      resourceList.setPluralForms(key, pluralForms);
      // Skip default plural form (index 0); the fall-through case will handle
      // it.
      for (int i = 1; i < pluralForms.length; ++i) {
        String template = resourceList.getStringExt(key,
View Full Code Here

      }
    } else {
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      PluralRule rule = createLocalizedPluralRule(logger,
          m.getEnclosingType().getOracle(), ruleClass, locale);
      logger.log(TreeLogger.TRACE, "Using plural rule " + rule.getClass()
          + " for locale '" + locale + "'", null);
      generated.append(PluralRule.class.getCanonicalName());
      generated.append(" rule = new " + rule.getClass().getCanonicalName()
          + "();\n");
      generated.append("switch (rule.select("
          + params[pluralParamIndex].getName() + ")) {\n");
      PluralForm[] pluralForms = rule.pluralForms();
      resourceList.setPluralForms(key, pluralForms);
      // Skip default plural form (index 0); the fall-through case will handle
      // it.
      for (int i = 1; i < pluralForms.length; ++i) {
        String template = resourceList.getStringExt(key,
View Full Code Here

      }
    } else {
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      PluralRule rule = createLocalizedPluralRule(logger,
          m.getEnclosingType().getOracle(), ruleClass, locale);
      logger.log(TreeLogger.TRACE, "Using plural rule " + rule.getClass()
          + " for locale '" + locale + "'", null);
      generated.append(PluralRule.class.getCanonicalName());
      generated.append(" rule = new " + rule.getClass().getCanonicalName()
          + "();\n");
      generated.append("switch (rule.select(arg" + pluralParamIndex + ")) {\n");
      PluralForm[] pluralForms = rule.pluralForms();
      resourceList.setPluralForms(key, pluralForms);
      // Skip default plural form (index 0); the fall-through case will handle
      // it.
      for (int i = 1; i < pluralForms.length; ++i) {
        String template = resourceList.getStringExt(key,
View Full Code Here

                        ? pluralRuleClass.getName() : DefaultRule.class.getName();
               pluralRuleClassName += "_" + locale.getLanguage();

               try {
                  Class<? extends PluralRule> acutalRule = (Class<? extends PluralRule>) GwtReflectionUtils.getClass(pluralRuleClassName);
                  PluralRule ruleInstance = acutalRule.newInstance();

                  sb.append(ruleInstance.pluralForms()[ruleInstance.select(count)].getName()).append(
                           "|");

               } catch (ClassNotFoundException e) {
                  throw new GwtTestI18NException("Cannot find PluralRule for method '"
                           + method.getDeclaringClass().getSimpleName() + "." + method.getName()
View Full Code Here

      if (defLocaleAnnot != null) {
        defaultLocale = defLocaleAnnot.value();
      } else {
        defaultLocale = DefaultLocale.DEFAULT_LOCALE;
      }
      PluralRule pluralRule = getLocalizedPluralRule(pluralClass,
          localeFactory.fromString(defaultLocale));
      return new PluralRuleAdapter(pluralRule);
    }
    Select selectAnnot = getAnnotation(Select.class);
    if (selectAnnot != null) {
View Full Code Here

      }
    } else {
      if (ruleClass == PluralRule.class) {
        ruleClass = DefaultRule.class;
      }
      PluralRule rule = createLocalizedPluralRule(logger,
          m.getEnclosingType().getOracle(), ruleClass, locale);
      logger.log(TreeLogger.TRACE, "Using plural rule " + rule.getClass()
          + " for locale '" + locale + "'", null);
      generated.append(PluralRule.class.getCanonicalName());
      generated.append(" rule = new " + rule.getClass().getCanonicalName()
          + "();\n");
      generated.append("switch (rule.select(arg" + pluralParamIndex + ")) {\n");
      PluralForm[] pluralForms = rule.pluralForms();
      resourceList.setPluralForms(key, pluralForms);
      // Skip default plural form (index 0); the fall-through case will handle
      // it.
      for (int i = 1; i < pluralForms.length; ++i) {
        String template = resourceList.getStringExt(key,
View Full Code Here

                    Plural plural;
                    // Check for a custom plural rule.
                    PluralCount pc = (PluralCount) annotation;
                    Class<? extends PluralRule> pluralRuleClass = pc.value();
                    if(!pluralRuleClass.isInterface() && PluralRule.class.isAssignableFrom(pluralRuleClass)) {
                        PluralRule customRule = this.instantiateCustomPluralRuleClass(pluralRuleClass);
                        plural = CustomPlural.fromNumber(customRule, num.intValue());
                    } else {
                        plural = GwtPlural.fromNumber(this.pluralRules, num.doubleValue());
                    }
                    formsNames.add(plural.getGwtValue());
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.client.PluralRule$PluralForm

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.