|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.util.MessageManager
public class MessageManager
The message manager provides a thin wrapper around Java's built-in localization support, supporting a policy of dividing up localization resources into logical units, all of the translations for which are contained in a single messages file.
The message manager assumes that the locale remains constant for the duration of its
operation. If the locale were to change during the operation of the client, a call to
setLocale(java.util.Locale) should be made to inform the message manager of the new locale (which will
clear the message bundle cache).
| Field Summary | |
|---|---|
static String |
GLOBAL_BUNDLE
The name of the global resource bundle (which other bundles revert to if they can't locate a message within themselves). |
| Constructor Summary | |
|---|---|
MessageManager(String resourcePrefix)
Constructs a message manager with the supplied resource prefix and the default locale. |
|
| Method Summary | |
|---|---|
MessageBundle |
getBundle(String path)
Fetches the message bundle for the specified path. |
Locale |
getLocale()
Get the locale that is being used to translate messages. |
void |
setClassLoader(ClassLoader loader)
Allows a custom classloader to be configured for locating translation resources. |
void |
setLocale(Locale locale)
Sets the locale to the specified locale. |
void |
setLocale(Locale locale,
boolean updateGlobal)
Sets the locale to the specified locale. |
void |
setPrefix(String resourcePrefix)
Sets the appropriate resource prefix for where to find subsequent message bundles. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String GLOBAL_BUNDLE
global.properties and live at
the top of the bundle hierarchy.
| Constructor Detail |
|---|
public MessageManager(String resourcePrefix)
rsrc.messages was provided and a message bundle with
the name game.chess was later requested, the message manager would attempt to
load a resource bundle with the path rsrc.messages.game.chess and would
eventually search for a file in the classpath with the path
rsrc/messages/game/chess.properties.
See the documentation for ResourceBundle.getBundle(String,Locale,ClassLoader)
for a more detailed explanation of how resource bundle paths are resolved.
| Method Detail |
|---|
public Locale getLocale()
public void setLocale(Locale locale)
public void setLocale(Locale locale,
boolean updateGlobal)
updateGlobal - set to true if you want the global bundle reloaded in the new localepublic void setPrefix(String resourcePrefix)
public void setClassLoader(ClassLoader loader)
public MessageBundle getBundle(String path)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||