Example usage for com.google.gwt.i18n.rebind LocaleUtils getCompileLocale

List of usage examples for com.google.gwt.i18n.rebind LocaleUtils getCompileLocale

Introduction

In this page you can find the example usage for com.google.gwt.i18n.rebind LocaleUtils getCompileLocale.

Prototype

public GwtLocale getCompileLocale() 

Source Link

Document

Returns the static compile-time locale for this permutation.

Usage

From source file:com.em.validation.rebind.generator.gwt.GwtMessageGenerator.java

License:Apache License

/**
 * Get the locale that is currently being generated
 * <br/><br/>//from w  ww.j av  a  2 s  . c om
 * taken from http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/i18n/rebind/LocalizableGenerator.java
 * 
 * @param logger
 * @param context
 * @return
 */
public GwtLocale getCurrentGenerationLocale(TreeLogger logger, GeneratorContext context) {
    // Get the current locale
    PropertyOracle propertyOracle = context.getPropertyOracle();
    LocaleUtils localeUtils = LocaleUtils.getInstance(logger, propertyOracle, context);
    GwtLocale locale = localeUtils.getCompileLocale();
    return locale;
}

From source file:fr.putnami.pwt.core.widget.rebind.UiBinderLocalizedGenerator.java

License:Open Source License

@Override
public String generate(TreeLogger logger, GeneratorContext context, String typeName)
        throws UnableToCompleteException {
    TypeOracle typeOracle = context.getTypeOracle();
    assert typeOracle != null;

    JClassType viewType = typeOracle.findType(typeName);
    if (viewType == null) {
        logger.log(TreeLogger.ERROR, "Unable to find metadata for type '" + typeName + "'", null);
        throw new UnableToCompleteException();
    }/*from  www . j  ava2  s. c  o m*/

    PropertyOracle propertyOracle = context.getPropertyOracle();
    LocaleUtils localeUtils = LocaleUtils.getInstance(logger, propertyOracle, context);
    GwtLocale locale = localeUtils.getCompileLocale();

    UiBinderLocalizedCreator creator = new UiBinderLocalizedCreator(viewType, locale);
    return creator.create(logger, context);
}