public final class MessageLocalization extends Object
Modifier and Type | Field and Description |
---|---|
private static String |
BASE_PATH |
private static HashMap<String,String> |
currentLanguage |
private static HashMap<String,String> |
defaultLanguage |
Modifier | Constructor and Description |
---|---|
private |
MessageLocalization() |
Modifier and Type | Method and Description |
---|---|
static String |
getComposedMessage(String key,
int p1)
Get a message with one parameter as an primitive int.
|
static String |
getComposedMessage(String key,
Object... param)
Get a message with param.length parameters or none if param is null.
|
private static HashMap<String,String> |
getLanguageMessages(String language,
String country) |
static String |
getMessage(String key)
Get a message without parameters.
|
private static HashMap<String,String> |
readLanguageStream(InputStream is) |
private static HashMap<String,String> |
readLanguageStream(Reader r) |
static boolean |
setLanguage(String language,
String country)
Sets the language to be used globally for the error messages.
|
static void |
setMessages(Reader r)
Sets the error messages directly from a Reader.
|
private static HashMap<String,String> defaultLanguage
private static HashMap<String,String> currentLanguage
private static final String BASE_PATH
private MessageLocalization()
public static String getMessage(String key)
key
- the key to the messagepublic static String getComposedMessage(String key, int p1)
key
- the key to the messagep1
- the parameterpublic static String getComposedMessage(String key, Object... param)
key
- the key to the messageparam
- array of parameter objects, (toString is used to add it to the message)public static boolean setLanguage(String language, String country) throws IOException
language
- the languagecountry
- the countryIOException
- on errorpublic static void setMessages(Reader r) throws IOException
r
- the ReaderIOException
- on errorprivate static HashMap<String,String> getLanguageMessages(String language, String country) throws IOException
IOException
private static HashMap<String,String> readLanguageStream(InputStream is) throws IOException
IOException
private static HashMap<String,String> readLanguageStream(Reader r) throws IOException
IOException
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses