Skip to content

Overview of Locale support #25

Closed
Closed
@rob-bygrave

Description

@rob-bygrave

Goals

  • validate a bean with a given locale
  • return ConstraintViolations with messages and property names for that locale
  • HTTP Accept-Language header -> Locale ... would be nice make this easy

Configuration for Validator.Build

  • Default Locale used by default when a locale can't be "resolved"
  • Set supplied as all the Locales that the validator instance will support. Extra Locales are not supported on the fly.

LocaleResolver

  • Knows the default locale and all supported locales
  • Given a requested locale (or Accept-Language) determine the Locale to use (fallback to default)

MessageFinder / ResoureBundleLookupThing (name?)

  • Given a message and locale get the correct message template. Expected to use ResourceBundle
  • Given a property name and path ... return a it8n version of the property name for a given locale

MessageInterpolator

  • Given a message template + attributes parse and return the final locale specific message

Note that in the case where only 1 locale is supported, it is possible to lookup & interpolate the messages once when the ValidatorAdapters are created, otherwise that needs to be done at runtime (with caching) based on the passed in request locale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions