|
Regain 2.1.0-STABLE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.regain.util.io.Localizer
public class Localizer
Field Summary | |
---|---|
private ResourceBundle |
mBundle
The ResourceBundle to get the messages from. |
private static HashMap |
mFileClassLoaderHash
Holds for a directory (File) an URLClassLoader that loads ressources from that directory (URLClassLoader). |
private String |
mKeyPrefix
The prefix to put before every key. |
private static org.apache.log4j.Logger |
mLog
The logger for this class. |
Constructor Summary | |
---|---|
Localizer(Class clazz)
Creates a new instance of Localizer. |
|
Localizer(Class clazz,
Locale locale)
Creates a new instance of Localizer. |
|
Localizer(URL baseurl,
String basename,
Locale locale)
Creates a new instance of Localizer. |
Method Summary | |
---|---|
private static URLClassLoader |
getClassLoader(URL baseurl)
Gets a class loader that loads ressources from a directory. |
String |
msg(String key,
String defaultMsg)
Gets a localized message. |
String |
msg(String key,
String defaultMsg,
Object arg1)
Gets a localized message. |
String |
msg(String key,
String defaultMsg,
Object[] args)
Gets a localized message. |
String |
msg(String key,
String defaultMsg,
Object arg1,
Object arg2)
Gets a localized message. |
String |
msg(String key,
String defaultMsg,
Object arg1,
Object arg2,
Object arg3)
Gets a localized message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static org.apache.log4j.Logger mLog
private ResourceBundle mBundle
private String mKeyPrefix
private static HashMap mFileClassLoaderHash
Constructor Detail |
---|
public Localizer(URL baseurl, String basename, Locale locale)
baseurl
- The URL to load the resource bundle from.basename
- The basename of the resource bundle to load.locale
- the locale to create the localizer for.public Localizer(Class clazz)
clazz
- The class to create the Localizer for.public Localizer(Class clazz, Locale locale)
clazz
- The class to create the Localizer for.locale
- the locale to create the localizer for.Method Detail |
---|
private static URLClassLoader getClassLoader(URL baseurl) throws MalformedURLException
baseurl
- The URL to load the ressources from.
MalformedURLException
- If the file could not be converted to an URL.public String msg(String key, String defaultMsg, Object arg1)
key
- The key of the message.defaultMsg
- The default message. (english)arg1
- The argument that should replace {0}
.
public String msg(String key, String defaultMsg, Object arg1, Object arg2)
key
- The key of the message.defaultMsg
- The default message. (english)arg1
- The argument that should replace {0}
.arg2
- The argument that should replace {1}
.
public String msg(String key, String defaultMsg, Object arg1, Object arg2, Object arg3)
key
- The key of the message.defaultMsg
- The default message. (english)arg1
- The argument that should replace {0}
.arg2
- The argument that should replace {1}
.arg3
- The argument that should replace {2}
.
public String msg(String key, String defaultMsg, Object[] args)
key
- The key of the message.defaultMsg
- The default message. (english)args
- The arguments that should replace the appropriate place holder.
See MessageFormat
for details.
public String msg(String key, String defaultMsg)
key
- The key of the message.defaultMsg
- The default message. (english)
|
Regain 2.1.0-STABLE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |