Package com.itextpdf.text.error_messages
Class MessageLocalization
- java.lang.Object
-
- com.itextpdf.text.error_messages.MessageLocalization
-
public final class MessageLocalization extends java.lang.ObjectLocalizes error messages. The messages are located in the package com.itextpdf.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)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetComposedMessage(java.lang.String key, int p1)Get a message with one parameter as an primitive int.static java.lang.StringgetComposedMessage(java.lang.String key, java.lang.Object... param)Get a message with param.length parameters or none if param is null.static java.lang.StringgetMessage(java.lang.String key)Get a message without parameters.static java.lang.StringgetMessage(java.lang.String key, boolean useDefaultLanguageIfMessageNotFound)static booleansetLanguage(java.lang.String language, java.lang.String country)Sets the language to be used globally for the error messages.static voidsetMessages(java.io.Reader r)Sets the error messages directly from a Reader.
-
-
-
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
-
getMessage
public static java.lang.String getMessage(java.lang.String key, boolean useDefaultLanguageIfMessageNotFound)
-
getComposedMessage
public static java.lang.String getComposedMessage(java.lang.String key, int p1)Get a message with one parameter as an primitive int. The parameter will replace the string "{1}" found in the message.- Parameters:
key- the key to the messagep1- the parameter- Returns:
- the message
-
getComposedMessage
public static java.lang.String getComposedMessage(java.lang.String key, java.lang.Object... param)Get a message with param.length parameters or none if param is null. In the message the "{1}", "{2}" to "{lenght of param array}" are replaced with the object.toString of the param array. (with param[0] being "{1}")- Parameters:
key- the key to the messageparam- array of parameter objects, (toString is used to add it to the message)- Returns:
- the message
- Since:
- iText 5.0.6
-
setLanguage
public static boolean setLanguage(java.lang.String language, java.lang.String country) throws java.io.IOExceptionSets 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 languagecountry- 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.IOExceptionSets the error messages directly from a Reader.- Parameters:
r- the Reader- Throws:
java.io.IOException- on error
-
-