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, Msg, Msg, Msg, Msg, Msg

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\$$/

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: MsgBase.java,v 1.6 2004/11/28 21:36:31 joe Exp $
Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
Licence, 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
 
Constructor Summary
protected MsgBase(String name)
          Create a MsgBase object
 
Method Summary
protected  void loadResources()
          Initialise any resource bundles
 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


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()
Initialise any resource bundles


Copyright ? 2003-2004