Package org.nuiton.i18n.plugin.bundle
Class StringFormatToMessageFormatConverter
java.lang.Object
org.nuiton.i18n.plugin.bundle.StringFormatToMessageFormatConverter
- All Implemented Interfaces:
BundleFormatConverter
@Component(role=BundleFormatConverter.class, hint="toMessageFormat") public class StringFormatToMessageFormatConverter extends java.lang.Object implements BundleFormatConverter
Implementation of
BundleFormatConverter to convert Formatter
syntax to a MessageFormat syntax.
Created: 05/05/11- Since:
- 2.4
- Author:
- Florian Desbois, Tony Chemit - chemit@codelutin.com
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.regex.PatternPATTERN -
Constructor Summary
Constructors Constructor Description StringFormatToMessageFormatConverter() -
Method Summary
Modifier and Type Method Description java.lang.Stringconvert(java.lang.String value)Convert format syntax to an other fromvalue.protected java.lang.StringescapeQuoteChar(java.lang.String value)Escape ' char with '', needed byMessageFormat.
-
Field Details
-
PATTERN
protected static java.util.regex.Pattern PATTERN
-
-
Constructor Details
-
StringFormatToMessageFormatConverter
public StringFormatToMessageFormatConverter()
-
-
Method Details
-
convert
public java.lang.String convert(java.lang.String value)Description copied from interface:BundleFormatConverterConvert format syntax to an other fromvalue.- Specified by:
convertin interfaceBundleFormatConverter- Parameters:
value- message with some format placeholders to convert- Returns:
- the message with other format syntax
-
escapeQuoteChar
protected java.lang.String escapeQuoteChar(java.lang.String value)Escape ' char with '', needed byMessageFormat.- Parameters:
value- Message that contains '- Returns:
- the message with ' escaped
-