Class MessageSourceHelper
java.lang.Object
com.github.jknack.handlebars.springmvc.MessageSourceHelper
- All Implemented Interfaces:
com.github.jknack.handlebars.Helper<String>
public class MessageSourceHelper
extends Object
implements com.github.jknack.handlebars.Helper<String>
A helper that delegates to a
MessageSource
instance. Usage:
{{message "code" args* [default="default message"] }}Where:
- code: String literal. Required.
- args: Object. Optional
- default: A default message. Optional.
- Since:
- 0.5.5
- Author:
- edgar.espina
- See Also:
-
LocaleContextHolder.getLocale()
-
Constructor Summary
ConstructorsConstructorDescriptionMessageSourceHelper
(org.springframework.context.MessageSource messageSource) Creates a newMessageSourceHelper
. -
Method Summary
-
Constructor Details
-
MessageSourceHelper
public MessageSourceHelper(org.springframework.context.MessageSource messageSource) Creates a newMessageSourceHelper
.- Parameters:
messageSource
- The message source. Required.
-
-
Method Details
-
apply
- Specified by:
apply
in interfacecom.github.jknack.handlebars.Helper<String>
- Throws:
IOException
-
currentLocale
Resolve the current user locale.- Returns:
- The current user locale.
-