Interface TranslationProvider

All Known Implementing Classes:
PropertiesTranslationProvider
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 TranslationProvider
A provider for message translations. Given a key of a translations and arguments for translation this provider is responsible for returning a fully translated message. How the translation is obtained and the arguments inserted into the translation is left to the provider implementation.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the translation for the given key with the given arguments inserted into it.
  • Method Details

    • translate

      Get the translation for the given key with the given arguments inserted into it. This method returns null in case the given translation key is not mapped to a translation in this provider.
      Parameters:
      key - the key of the translation to get.
      args - the arguments that can be inserted into the message.
      Returns:
      the translated message, filled with the given arguments or null if the message key is unknown.
      Throws:
      NullPointerException - if the given key or arguments array is null.
      IllegalArgumentException - if one of the given placeholder arguments is invalid.