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.Pattern PATTERN  
  • Constructor Summary

    Constructors 
    Constructor Description
    StringFormatToMessageFormatConverter()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String convert​(java.lang.String value)
    Convert format syntax to an other from value.
    protected java.lang.String escapeQuoteChar​(java.lang.String value)
    Escape ' char with '', needed by MessageFormat.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PATTERN

      protected static java.util.regex.Pattern PATTERN
  • Constructor Details

  • Method Details

    • convert

      public java.lang.String convert​(java.lang.String value)
      Description copied from interface: BundleFormatConverter
      Convert format syntax to an other from value.
      Specified by:
      convert in interface BundleFormatConverter
      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 by MessageFormat.
      Parameters:
      value - Message that contains '
      Returns:
      the message with ' escaped