org.crosswire.common.util
Class MsgBase

java.lang.Object
  extended by org.crosswire.common.util.MsgBase
Direct Known Subclasses:
Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, Msg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg, UserMsg

public class MsgBase
extends Object

A base class for implementing type safe internationalization (i18n) that is easy for most cases. See Msg for an example of how to inherit from here.

Some Regex/Vi macros to convert from a half way house i18n scheme where the strings are in Msg classes but not properties files: The following makes the lookup string simple :%s/Msg \([^ ]*\) = new Msg(".*")/Msg \1 = new Msg("\1")/ These turn a lookup string into a properties file :%s/ static final Msg // :%s/ = new Msg("/: / :%s/");\/\/\$NON-NLS-1\$$/

Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details.
The copyright to this program is held by it's authors.
, Msg

Field Summary
private static Logger log
          The log stream
private  String name
           
private static Map resourceMap
          resource map maintains a mapping of class names to resources found by that name.
private  ResourceBundle resources
          If there is any internationalization to be done, it is thru this
private  NumberShaper shaper
          Internationalize numbers
 
Constructor Summary
protected MsgBase(String name)
          Create a MsgBase object
 
Method Summary
protected  void loadResources()
          Initialize any resource bundles
private  String obtainString()
           
 String toString()
           
 String toString(Object param)
          Formats the message with the given parameter.
 String toString(Object[] params)
          Formats the message with the given parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private String name

resourceMap

private static Map resourceMap
resource map maintains a mapping of class names to resources found by that name.


resources

private ResourceBundle resources
If there is any internationalization to be done, it is thru this


shaper

private NumberShaper shaper
Internationalize numbers


log

private static final Logger log
The log stream

Constructor Detail

MsgBase

protected MsgBase(String name)
Create a MsgBase object

Method Detail

toString

public String toString()
Overrides:
toString in class Object

toString

public String toString(Object param)
Formats the message with the given parameter.


toString

public String toString(Object[] params)
Formats the message with the given parameters.


loadResources

protected final void loadResources()
Initialize any resource bundles


obtainString

private String obtainString()

Copyright ยจ 2003-2007