Class MessageLocalization
java.lang.Object
org.openpdf.text.error_messages.MessageLocalization
Localizes error messages. The messages are located in the package org.openpdf.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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetComposedMessage(String key) Get a message without parameters.static StringgetComposedMessage(String key, int p1) Get a message with one parameter.static StringgetComposedMessage(String key, Object p1) Get a message with one parameter.static StringgetComposedMessage(String key, Object p1, Object p2) Get a message with one parameter.static StringgetComposedMessage(String key, Object p1, Object p2, Object p3) Get a message with one parameter.static StringGet a message with two parameters.getLanguageMessages(String language, String country) static StringgetMessage(String key) Get a message without parameters.static booleansetLanguage(String language, String country) Sets the language to be used globally for the error messages.static voidSets the error messages directly from a Reader.
-
Field Details
-
BASE_PATH
- See Also:
-
defaultLanguage
-
currentLanguage
-
-
Constructor Details
-
MessageLocalization
private MessageLocalization()
-
-
Method Details
-
getMessage
-
getComposedMessage
-
getComposedMessage
-
getComposedMessage
-
getComposedMessage
-
getComposedMessage
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 messagep1- the parameterp2- the parameterp3- the parameter- Returns:
- the message
-
getComposedMessage
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 messagep1- the parameterp2- the parameterp3- the parameterp4- the parameter- Returns:
- the message
-
setLanguage
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 languagecountry- the country- Returns:
- true if the language was found, false otherwise
- Throws:
IOException- on error
-
setMessages
Sets the error messages directly from a Reader.- Parameters:
r- the Reader- Throws:
IOException- on error
-
getLanguageMessages
private static Map<String,String> getLanguageMessages(String language, String country) throws IOException - Throws:
IOException
-
readLanguageStream
- Throws:
IOException
-
readLanguageStream
- Throws:
IOException
-
getAllKeys
-