com.holonplatform.core.i18n

## Interface MessageProvider

- Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

      @FunctionalInterface
      public interface MessageProvider

  Main interface to be used with a `LocalizationContext` to localize messages according to a `Locale`.
  Since:
    5.0.0
  See Also:
    `LocalizationContext`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `MessageProvider.PropertiesMessageProviderBuilder` Builder to create `PropertiesMessageProvider` instances

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_MESSAGE_ARGUMENT_PLACEHOLDER` Default argument placeholder for message localization

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MessageProvider.PropertiesMessageProviderBuilder` | `fromProperties(String... basenames)` Builder to create a `MessageProvider` which uses properties files as messages source.
    `Optional<String>` | `getMessage(Locale locale, String code)` Get a localized message in given `locale` for specified message `code`

- - ### Field Detail

    - #### DEFAULT_MESSAGE_ARGUMENT_PLACEHOLDER

          static final String DEFAULT_MESSAGE_ARGUMENT_PLACEHOLDER

      Default argument placeholder for message localization
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getMessage

          Optional<String> getMessage(Locale locale,
                                      String code)
                               throws Localizable.LocalizationException

      Get a localized message in given `locale` for specified message `code`
      Parameters:
        `locale` - Locale
        `code` - Message code
      Returns:
        Optional localized message
      Throws:
        `Localizable.LocalizationException` - Error retrieving message

    - #### fromProperties

          static MessageProvider.PropertiesMessageProviderBuilder fromProperties(String... basenames)

      Builder to create a `MessageProvider` which uses properties files as messages source.

      Properties files are resolved using configured basenames as prefix, and `Locale` language, country and variant separated by an underscore as file name. Files must have `.properties` extension.

      The basenames follow `ResourceBundle` conventions: essentially, a fully-qualified classpath location. If it doesn't contain a package qualifier, it will be resolved from the classpath root. Note that the JDK's standard ResourceBundle treats dots as package separators: This means that "test.messages" is equivalent to "test/messages".

      Parameters:
        `basenames` - Basenames for resource locations
      Returns:
        PropertiesMessageProviderBuilder

Copyright © 2017 The Holon Platform. All rights reserved.