Interface ContextMessageSource

  • All Known Implementing Classes:
    ContextMessageSourceImpl

    public interface ContextMessageSource
    Returns messages based on the LocaleContextHolder
    • Method Detail

      • getMessage

        String getMessage​(String code)
        Returns the message in the locale of the current user.
        Parameters:
        code - the code to lookup up, such as 'calculator.noRateSet'
        Returns:
        the resolved message, never null
        Throws:
        org.springframework.context.NoSuchMessageException - if the message wasn't found
      • getMessage

        String getMessage​(String code,
                          @Nullable @CheckForNull
                          Object[] args)
        Returns the message in the locale of the current user.
        Parameters:
        code - the code to lookup up, such as 'calculator.noRateSet'
        args - an array of arguments that will be filled in for params within the message (params look like "{0}", "{1,date}", "{2,time}" within a message), * or null if none.
        Returns:
        the resolved message, never null
        Throws:
        org.springframework.context.NoSuchMessageException - if the message wasn't found