Package play.i18n

Interface Messages

All Superinterfaces:
play.api.i18n.MessagesProvider
All Known Implementing Classes:
MessagesImpl

public interface Messages extends play.api.i18n.MessagesProvider
A Messages will produce messages using a specific language.

This interface that is typically backed by MessagesImpl, but does not return MessagesApi.

  • Method Details

    • lang

      Lang lang()
      Get the lang for these messages.
      Returns:
      the chosen language
    • apply

      default String apply(String key, Object... args)
      Get the message at the given key.

      Uses `java.text.MessageFormat` internally to format the message.

      Parameters:
      key - the message key
      args - the message arguments
      Returns:
      the formatted message or a default rendering if the key wasn't defined
    • apply

      default String apply(List<String> keys, Object... args)
      Get the message at the first defined key.

      Uses `java.text.MessageFormat` internally to format the message.

      Parameters:
      keys - the messages keys
      args - the message arguments
      Returns:
      the formatted message or a default rendering if the key wasn't defined
    • at

      String at(String key, Object... args)
      Get the message at the given key.

      Uses `java.text.MessageFormat` internally to format the message.

      Parameters:
      key - the message key
      args - the message arguments
      Returns:
      the formatted message or a default rendering if the key wasn't defined
    • at

      String at(List<String> keys, Object... args)
      Get the message at the first defined key.

      Uses `java.text.MessageFormat` internally to format the message.

      Parameters:
      keys - the messages keys
      args - the message arguments
      Returns:
      the formatted message or a default rendering if the key wasn't defined
    • isDefinedAt

      Boolean isDefinedAt(String key)
      Check if a message key is defined.
      Parameters:
      key - the message key
      Returns:
      a Boolean
    • asScala

      play.api.i18n.Messages asScala()
    • messages

      default play.api.i18n.Messages messages()
      Specified by:
      messages in interface play.api.i18n.MessagesProvider