Package org.nuiton.i18n.format
Class StringFormatI18nMessageFormatter
java.lang.Object
org.nuiton.i18n.format.StringFormatI18nMessageFormatter
- All Implemented Interfaces:
I18nMessageFormatter
public class StringFormatI18nMessageFormatter extends java.lang.Object implements I18nMessageFormatter
Implementation of
I18nMessageFormatter based on Formatter
syntax.
Note: This is the default message formatter used by
i18n system.- Since:
- 2.4
- See Also:
Formatter,String.format(Locale, String, Object...)
-
Constructor Summary
Constructors Constructor Description StringFormatI18nMessageFormatter() -
Method Summary
Modifier and Type Method Description java.lang.Stringformat(java.util.Locale locale, java.lang.String message, java.lang.Object... args)Format a givenmessagewithlocaleand optinalargs.
-
Constructor Details
-
StringFormatI18nMessageFormatter
public StringFormatI18nMessageFormatter()
-
-
Method Details
-
format
public java.lang.String format(java.util.Locale locale, java.lang.String message, java.lang.Object... args)Description copied from interface:I18nMessageFormatterFormat a givenmessagewithlocaleand optinalargs. The main purpose is to replace placeholders inmessagewithargsvalue. This may depend onlocalefor date purpose for example.- Specified by:
formatin 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
-