Package com.google.gwt.i18n.shared

Examples of com.google.gwt.i18n.shared.GwtLocaleFactory


      GeneratorContext genCtx) {
    List<GwtLocale> locales = bundleLocale.getCompleteSearchList();
    List<JClassType> classes = new ArrayList<JClassType>();
    Set<JClassType> seenClasses = new IdentityHashSet<JClassType>();
    Map<ClassLocale, AnnotationsResource> annotations = new HashMap<ClassLocale, AnnotationsResource>();
    GwtLocaleFactory factory = LocaleUtils.getLocaleFactory();
    GwtLocale defaultLocale = factory.getDefault();
    walkInheritanceTree(logger, topClass, factory, defaultLocale, classes,
        annotations, seenClasses, isConstants);
    // TODO(jat): handle explicit subinterface with other locales -- ie:
    // public interface Foo_es_MX extends Foo { ... }
    ResourceList allResources = new ResourceList();
View Full Code Here


    LocalizableLinkageCreator llc = new LocalizableLinkageCreator();
    TreeLogger logger = new FailErrorLogger();
    TypeOracle oracle = TypeOracleTestingUtils.buildStandardTypeOracleWith(
        logger, LOCALIZABLE, TEST, TEST_IW);
    JClassType test = oracle.findType("foo.Test");
    GwtLocaleFactory factory = new GwtLocaleFactoryImpl();
    GwtLocale locale = factory.fromString("he");
    String implClass = llc.linkWithImplClass(logger, test, locale);
    assertEquals("foo.Test_iw", implClass);
    oracle = TypeOracleTestingUtils.buildStandardTypeOracleWith(
        logger, LOCALIZABLE, TEST, TEST_HE);
    test = oracle.findType("foo.Test");
    locale = factory.fromString("iw");
    implClass = llc.linkWithImplClass(logger, test, locale);
    assertEquals("foo.Test_he", implClass);
  }
View Full Code Here

  /**
   * Test method for {@link com.google.gwt.i18n.rebind.LocaleUtils#getAllCompileLocales()}.
   */
  public void testGetAllCompileLocales() {
    LocaleUtils localeUtils = LocaleUtils.getInstance(logger, props, ctx);
    GwtLocaleFactory factory = LocaleUtils.getLocaleFactory();
    Set<GwtLocale> locales = localeUtils.getAllCompileLocales();
    assertEquals(3, locales.size());
    assertContains(locales, factory.fromString("es_419"));
    assertContains(locales, factory.fromString("es"));
    assertContains(locales, factory.fromString("en"));
  }
View Full Code Here

  /**
   * Test method for {@link com.google.gwt.i18n.rebind.LocaleUtils#getAllLocales()}.
   */
  public void testGetAllLocales() {
    LocaleUtils localeUtils = LocaleUtils.getInstance(logger, props, ctx);
    GwtLocaleFactory factory = LocaleUtils.getLocaleFactory();
    Set<GwtLocale> locales = localeUtils.getAllLocales();
    assertEquals(7, locales.size());
    assertContains(locales, factory.fromString("es_419"));
    assertContains(locales, factory.fromString("es"));
    assertContains(locales, factory.fromString("en"));
    assertContains(locales, factory.fromString("es_AR"));
    assertContains(locales, factory.fromString("es_CO"));
    assertContains(locales, factory.fromString("es_ES"));
    assertContains(locales, factory.fromString("es_GB"));
  }
View Full Code Here

  /**
   * Test method for {@link com.google.gwt.i18n.rebind.LocaleUtils#getRuntimeLocales()}.
   */
  public void testGetRuntimeLocales() {
    LocaleUtils localeUtils = LocaleUtils.getInstance(logger, props, ctx);
    GwtLocaleFactory factory = LocaleUtils.getLocaleFactory();
    Set<GwtLocale> locales = localeUtils.getRuntimeLocales();
    assertEquals(2, locales.size());
    assertContains(locales, factory.fromString("es_AR"));
    assertContains(locales, factory.fromString("es_CO"));

    localeProp.setCurrentValue("es");
    LocaleUtils localeUtils2 = LocaleUtils.getInstance(logger, props, ctx);
    localeProp.setCurrentValue("es_419");
    assertNotSame(localeUtils, localeUtils2);

    // check that we don't pick up runtime locales that are under a more-specific compile locale
    locales = localeUtils2.getRuntimeLocales();
    assertEquals(2, locales.size());
    assertContains(locales, factory.fromString("es_ES"));
    assertContains(locales, factory.fromString("es_GB"));
  }
View Full Code Here

        public boolean accept(File dir, String name) {
          return dtcProps.matcher(name).matches();
        }
      });
      TreeMap<Key, String[]> properties = new TreeMap<Key, String[]>();
      GwtLocaleFactory factory = LocaleUtils.getLocaleFactory();
      collectPropertyData(propFiles, properties, factory);
      Map<GwtLocale, Set<GwtLocale>> parents = removeInheritedValues(properties);
      generateSources(properties, parents);
    }
View Full Code Here

      Map<String, Resource> resourceMap) {
    List<GwtLocale> locales = bundleLocale.getCompleteSearchList();
    List<JClassType> classes = new ArrayList<JClassType>();
    Set<JClassType> seenClasses = new IdentityHashSet<JClassType>();
    Map<ClassLocale, AnnotationsResource> annotations = new HashMap<ClassLocale, AnnotationsResource>();
    GwtLocaleFactory factory = LocaleUtils.getLocaleFactory();
    GwtLocale defaultLocale = factory.getDefault();
    walkInheritanceTree(logger, topClass, factory, defaultLocale, classes,
        annotations, seenClasses, isConstants);
    // TODO(jat): handle explicit subinterface with other locales -- ie:
    // public interface Foo_es_MX extends Foo { ... }
    ResourceList allResources = new ResourceList();
View Full Code Here

    Set<GwtLocale> allCompileLocales = new HashSet<GwtLocale>();
    Set<GwtLocale> runtimeLocales = new HashSet<GwtLocale>();
    String localeName = localeProp.getCurrentValue();
    SortedSet<String> localeValues = localeProp.getPossibleValues();

    GwtLocaleFactory factoryInstance = getLocaleFactory();
    GwtLocale newCompileLocale = factoryInstance.fromString(localeName);
    compileLocale = newCompileLocale;
    for (String localeValue : localeValues) {
      allCompileLocales.add(factoryInstance.fromString(localeValue));
    }
    allLocales.addAll(allCompileLocales);

    List<String> rtLocaleNames = prop.getValues();
    if (rtLocaleNames != null) {
      for (String rtLocale : rtLocaleNames) {
        GwtLocale locale = factoryInstance.fromString(rtLocale);
        // TODO(jat): remove use of labels
        existingLocales:
        for (GwtLocale existing : allCompileLocales) {
          for (GwtLocale alias : existing.getAliases()) {
            if (!alias.isDefault() && locale.inheritsFrom(alias)
View Full Code Here

    if (cookie.length() == 0) {
      cookie = null;
    }
    SortedSet<String> localeValues = localeProp.getPossibleValues();

    GwtLocaleFactory factoryInstance = getLocaleFactory();
    GwtLocale newCompileLocale = factoryInstance.fromString(localeName);
    compileLocale = newCompileLocale;
    for (String localeValue : localeValues) {
      allCompileLocales.add(factoryInstance.fromString(localeValue));
    }
    allLocales.addAll(allCompileLocales);

    List<String> rtLocaleNames = prop.getValues();
    if (rtLocaleNames != null) {
      for (String rtLocale : rtLocaleNames) {
        GwtLocale locale = factoryInstance.fromString(rtLocale);
        // TODO(jat): remove use of labels
        existingLocales:
        for (GwtLocale existing : allCompileLocales) {
          for (GwtLocale alias : existing.getAliases()) {
            if (!alias.isDefault() && locale.inheritsFrom(alias)
View Full Code Here

    Set<GwtLocale> allCompileLocales = new HashSet<GwtLocale>();
    Set<GwtLocale> runtimeLocales = new HashSet<GwtLocale>();
    String localeName = localeProp.getCurrentValue();
    SortedSet<String> localeValues = localeProp.getPossibleValues();

    GwtLocaleFactory factoryInstance = getLocaleFactory();
    GwtLocale newCompileLocale = factoryInstance.fromString(localeName);
    compileLocale = newCompileLocale;
    for (String localeValue : localeValues) {
      allCompileLocales.add(factoryInstance.fromString(localeValue));
    }
    allLocales.addAll(allCompileLocales);

    List<String> rtLocaleNames = prop.getValues();
    if (rtLocaleNames != null) {
      for (String rtLocale : rtLocaleNames) {
        GwtLocale locale = factoryInstance.fromString(rtLocale);
        // TODO(jat): remove use of labels
        existingLocales:
        for (GwtLocale existing : allCompileLocales) {
          for (GwtLocale alias : existing.getAliases()) {
            if (!alias.isDefault() && locale.inheritsFrom(alias)
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.shared.GwtLocaleFactory

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.