Package org.nuiton.i18n.format
Class MessageFormatI18nMessageFormatter
- java.lang.Object
-
- org.nuiton.i18n.format.MessageFormatI18nMessageFormatter
-
- All Implemented Interfaces:
I18nMessageFormatter
public class MessageFormatI18nMessageFormatter extends Object implements I18nMessageFormatter
Implementation ofI18nMessageFormatter
based onMessageFormat
syntax. Note: A formatter will always be used even if there is no parameters in translation. AsMessageFormat
requires to espece quotes, we need to do this for every translation with or without parameters.- Since:
- 2.4
- See Also:
MessageFormat
-
-
Constructor Summary
Constructors Constructor Description MessageFormatI18nMessageFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(Locale locale, String message, Object... args)
Format a givenmessage
withlocale
and optinalargs
.
-
-
-
Method Detail
-
format
public String format(Locale locale, String message, Object... args)
Description copied from interface:I18nMessageFormatter
Format a givenmessage
withlocale
and optinalargs
. The main purpose is to replace placeholders inmessage
withargs
value. This may depend onlocale
for date purpose for example.- Specified by:
format
in interfaceI18nMessageFormatter
- Parameters:
locale
- locale to use for formatting (number, date, ...)message
- message to format (that contains placeholders)args
- object array to use in formatting the message- Returns:
- the formatted message
-
-