GWT 2.7.0

## com.google.gwt.i18n.linker
Class LocalePropertyProviderGenerator

    java.lang.Object
      com.google.gwt.i18n.linker.LocalePropertyProviderGenerator

All Implemented Interfaces:
  PropertyProviderGenerator

    public class LocalePropertyProviderGenerator

extends java.lang.Object
implements PropertyProviderGenerator

Generates a property provider implementation for the "locale" property.

Field Summary
`protected static java.util.regex.Pattern` | `COOKIE_PATTERN`
`static java.lang.String` | `LOCALE_COOKIE`
`static java.lang.String` | `LOCALE_QUERYPARAM`
`static java.lang.String` | `LOCALE_SEARCHORDER`
`static java.lang.String` | `LOCALE_USEMETA`
`static java.lang.String` | `LOCALE_USERAGENT`
`protected static java.util.regex.Pattern` | `QUERYPARAM_PATTERN`

Constructor Summary
`LocalePropertyProviderGenerator()`

Method Summary
`java.lang.String` | `generate(TreeLogger logger, java.util.SortedSet<java.lang.String> possibleValues, java.lang.String fallback, java.util.SortedSet<ConfigurationProperty> configProperties)` Generate a property provider.
`protected void` | `generateCookieLookup(TreeLogger logger, com.google.gwt.user.rebind.SourceWriter body, java.lang.String cookieName)` Generate JS code that looks up the locale value from a cookie.
`protected void` | `generateInheritanceLookup(TreeLogger logger, com.google.gwt.user.rebind.SourceWriter body)` Generate JS code that takes the value of the "locale" variable and finds parent locales until the value is a supported locale or the default locale.
`protected void` | `generateMetaLookup(TreeLogger logger, com.google.gwt.user.rebind.SourceWriter body)` Generate JS code to fetch the locale from a meta property.
`protected void` | `generateQueryParamLookup(TreeLogger logger, com.google.gwt.user.rebind.SourceWriter body, java.lang.String queryParam)` Generate JS code to get the locale from a query parameter.
`protected void` | `generateUserAgentLookup(TreeLogger logger, com.google.gwt.user.rebind.SourceWriter body)` Generate JS code to fetch the locale from the user agent's compile-time locale.
`protected static boolean` | `isTrue(java.lang.String value)` Return true when the supplied value represents a true/yes/on value.
`protected boolean` | `validateCookieName(java.lang.String cookieName)` Validate that a name is a valid cookie name.
`protected boolean` | `validateQueryParam(java.lang.String queryParam)` Validate that a value is a valid query parameter name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LOCALE_QUERYPARAM

    public static final java.lang.String LOCALE_QUERYPARAM

See Also:
  Constant Field Values

### LOCALE_COOKIE

    public static final java.lang.String LOCALE_COOKIE

See Also:
  Constant Field Values

### LOCALE_SEARCHORDER

    public static final java.lang.String LOCALE_SEARCHORDER

See Also:
  Constant Field Values

### LOCALE_USEMETA

    public static final java.lang.String LOCALE_USEMETA

See Also:
  Constant Field Values

### LOCALE_USERAGENT

    public static final java.lang.String LOCALE_USERAGENT

See Also:
  Constant Field Values

### COOKIE_PATTERN

    protected static final java.util.regex.Pattern COOKIE_PATTERN

### QUERYPARAM_PATTERN

    protected static final java.util.regex.Pattern QUERYPARAM_PATTERN

Constructor Detail

### LocalePropertyProviderGenerator

    public LocalePropertyProviderGenerator()

Method Detail

### isTrue

    protected static boolean isTrue(java.lang.String value)

  Return true when the supplied value represents a true/yes/on value.

  Parameters:
    `value` -
  Returns:
    true if the string represents true/yes/on

### generate

    public java.lang.String generate(TreeLogger logger,
                                     java.util.SortedSet<java.lang.String> possibleValues,
                                     java.lang.String fallback,
                                     java.util.SortedSet<ConfigurationProperty> configProperties)
                              throws UnableToCompleteException

  Description copied from interface: `PropertyProviderGenerator`
  Generate a property provider.

  Specified by:
    `generate` in interface `PropertyProviderGenerator`
  Parameters:
    `logger` - TreeLogger
    `possibleValues` - the possible values of this property
    `fallback` - the fallback value for this property, or null
    `configProperties` - the configuration properties for this module
  Returns:
    the JS source of the property provider (the complete body of a JS function taking no arguments, including open/close braces), or null to use the default implementation in the property-provider tag
  Throws:
    `UnableToCompleteException` - after logging the message if processing is unable to continue

### generateCookieLookup

    protected void generateCookieLookup(TreeLogger logger,
                                        com.google.gwt.user.rebind.SourceWriter body,
                                        java.lang.String cookieName)
                                 throws UnableToCompleteException

  Generate JS code that looks up the locale value from a cookie.

  Parameters:
    `logger` - logger to use
    `body` -
    `cookieName` -
  Throws:
    `UnableToCompleteException`

### generateInheritanceLookup

    protected void generateInheritanceLookup(TreeLogger logger,
                                             com.google.gwt.user.rebind.SourceWriter body)
                                      throws UnableToCompleteException

  Generate JS code that takes the value of the "locale" variable and finds parent locales until the value is a supported locale or the default locale.

  Parameters:
    `logger` - logger to use
    `body` -
  Throws:
    `UnableToCompleteException`

### generateMetaLookup

    protected void generateMetaLookup(TreeLogger logger,
                                      com.google.gwt.user.rebind.SourceWriter body)
                               throws UnableToCompleteException

  Generate JS code to fetch the locale from a meta property.

  Parameters:
    `logger` - logger to use
    `body` -
  Throws:
    `UnableToCompleteException`

### generateQueryParamLookup

    protected void generateQueryParamLookup(TreeLogger logger,
                                            com.google.gwt.user.rebind.SourceWriter body,
                                            java.lang.String queryParam)
                                     throws UnableToCompleteException

  Generate JS code to get the locale from a query parameter.

  Parameters:
    `logger` - logger to use
    `body` - where to append JS output
    `queryParam` - the query parameter to use
  Throws:
    `UnableToCompleteException`

### generateUserAgentLookup

    protected void generateUserAgentLookup(TreeLogger logger,
                                           com.google.gwt.user.rebind.SourceWriter body)
                                    throws UnableToCompleteException

  Generate JS code to fetch the locale from the user agent's compile-time locale.

  Parameters:
    `logger` - logger to use
    `body` -
  Throws:
    `UnableToCompleteException`

### validateCookieName

    protected boolean validateCookieName(java.lang.String cookieName)

  Validate that a name is a valid cookie name.

  Parameters:
    `cookieName` -
  Returns:
    true if cookieName is an acceptable cookie name

### validateQueryParam

    protected boolean validateQueryParam(java.lang.String queryParam)

  Validate that a value is a valid query parameter name.

  Parameters:
    `queryParam` -
  Returns:
    true if queryParam is a valid query parameter name.

GWT 2.7.0