## com.lowagie.text.error_messages
Class MessageLocalization

    java.lang.Object
      com.lowagie.text.error_messages.MessageLocalization

    public final class MessageLocalization

extends java.lang.Object

Localizes error messages. The messages are located in the package com.lowagie.text.error_messages in the form language_country.lng. The internal file encoding is UTF-8 without any escape chars, it's not a normal property file. See en.lng for more information on the internal format.

Author:
  Paulo Soares (psoares@glintt.com)

Field Summary
`private static java.lang.String` `BASE_PATH`
`private static java.util.HashMap` `currentLanguage`
`private static java.util.HashMap` `defaultLanguage`

Constructor Summary
`private` `MessageLocalization()`

Method Summary
`static java.lang.String` `getComposedMessage(java.lang.String key)` Get a message without parameters.
`static java.lang.String` `getComposedMessage(java.lang.String key, int p1)` Get a message with one parameter.
`static java.lang.String` `getComposedMessage(java.lang.String key, java.lang.Object p1)` Get a message with one parameter.
`static java.lang.String` `getComposedMessage(java.lang.String key, java.lang.Object p1, java.lang.Object p2)` Get a message with one parameter.
`static java.lang.String` `getComposedMessage(java.lang.String key, java.lang.Object p1, java.lang.Object p2, java.lang.Object p3)` Get a message with one parameter.
`static java.lang.String` `getComposedMessage(java.lang.String key, java.lang.Object p1, java.lang.Object p2, java.lang.Object p3, java.lang.Object p4)` Get a message with two parameters.
`private static java.util.HashMap` `getLanguageMessages(java.lang.String language, java.lang.String country)`
`static java.lang.String` `getMessage(java.lang.String key)` Get a message without parameters.
`private static java.util.HashMap` `readLanguageStream(java.io.InputStream is)`
`private static java.util.HashMap` `readLanguageStream(java.io.Reader r)`
`static boolean` `setLanguage(java.lang.String language, java.lang.String country)` Sets the language to be used globally for the error messages.
`static void` `setMessages(java.io.Reader r)` Sets the error messages directly from a Reader.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### defaultLanguage

    private static java.util.HashMap defaultLanguage

### currentLanguage

    private static java.util.HashMap currentLanguage

### BASE_PATH

    private static final java.lang.String BASE_PATH

See Also:
  Constant Field Values

Constructor Detail

### MessageLocalization

    private MessageLocalization()

Method Detail

### getMessage

    public static java.lang.String getMessage(java.lang.String key)

  Get a message without parameters.

  Parameters:
    `key` - the key to the message
  Returns:
    the message

### getComposedMessage

    public static java.lang.String getComposedMessage(java.lang.String key)

  Get a message without parameters.

  Parameters:
    `key` - the key to the message
  Returns:
    the message

### getComposedMessage

    public static java.lang.String getComposedMessage(java.lang.String key,
                                                      java.lang.Object p1)

  Get a message with one parameter. The parameter will replace the string "{1}" found in the message.

  Parameters:
    `key` - the key to the message
    `p1` - the parameter
  Returns:
    the message

### getComposedMessage

    public static java.lang.String getComposedMessage(java.lang.String key,
                                                      int p1)

  Get a message with one parameter. The parameter will replace the string "{1}" found in the message.

  Parameters:
    `key` - the key to the message
    `p1` - the parameter
  Returns:
    the message

### getComposedMessage

    public static java.lang.String getComposedMessage(java.lang.String key,
                                                      java.lang.Object p1,
                                                      java.lang.Object p2)

  Get a message with one parameter. The parameter will replace the string "{1}", "{2}" found in the message.

  Parameters:
    `key` - the key to the message
    `p1` - the parameter
    `p2` - the parameter
  Returns:
    the message

### getComposedMessage

    public static java.lang.String getComposedMessage(java.lang.String key,
                                                      java.lang.Object p1,
                                                      java.lang.Object p2,
                                                      java.lang.Object p3)

  Get a message with one parameter. The parameter will replace the string "{1}", "{2}", "{3}" found in the message.

  Parameters:
    `key` - the key to the message
    `p1` - the parameter
    `p2` - the parameter
    `p3` - the parameter
  Returns:
    the message

### getComposedMessage

    public static java.lang.String getComposedMessage(java.lang.String key,
                                                      java.lang.Object p1,
                                                      java.lang.Object p2,
                                                      java.lang.Object p3,
                                                      java.lang.Object p4)

  Get a message with two parameters. The parameters will replace the strings "{1}", "{2}", "{3}", "{4}" found in the message.

  Parameters:
    `key` - the key to the message
    `p1` - the parameter
    `p2` - the parameter
    `p3` - the parameter
    `p4` - the parameter
  Returns:
    the message

### setLanguage

    public static boolean setLanguage(java.lang.String language,
                                      java.lang.String country)
                               throws java.io.IOException

  Sets the language to be used globally for the error messages. The language is a two letter lowercase country designation like "en" or "pt". The country is an optional two letter uppercase code like "US" or "PT".

  Parameters:
    `language` - the language
    `country` - the country
  Returns:
    true if the language was found, false otherwise
  Throws:
    `java.io.IOException` - on error

### setMessages

    public static void setMessages(java.io.Reader r)
                            throws java.io.IOException

  Sets the error messages directly from a Reader.

  Parameters:
    `r` - the Reader
  Throws:
    `java.io.IOException` - on error

### getLanguageMessages

    private static java.util.HashMap getLanguageMessages(java.lang.String language,
                                                         java.lang.String country)
                                                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### readLanguageStream

    private static java.util.HashMap readLanguageStream(java.io.InputStream is)
                                                 throws java.io.IOException

  Throws:
    `java.io.IOException`

### readLanguageStream

    private static java.util.HashMap readLanguageStream(java.io.Reader r)
                                                 throws java.io.IOException

  Throws:
    `java.io.IOException`

Hosted by Hostbasket