Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.util
Class MsgBase

    java.lang.Object
      org.crosswire.common.util.MsgBase

Direct Known Subclasses:
  FTPMsg, GPLMsg, JSMsg, JSOtherMsg, LGPLMsg

    public class MsgBase

extends Object

A base class for implementing type safe internationalization (i18n) that is easy for most cases.

Author:
  Joe Walker, DM Smith
See Also:
  `The GNU Lesser General Public License for details.`

Field Summary
`private static Map<Locale,Map<String,ResourceBundle>>` | `localeToResourceMap`
`private static org.slf4j.Logger` | `log` The log stream
`private NumberShaper` | `shaper` Internationalize numbers

Constructor Summary
`protected` | `MsgBase()` Create a MsgBase object

Method Summary
`private Map<String,ResourceBundle>` | `getLazyLocalisedResourceMap(Locale currentUserLocale)` Gets the localised resource map, initialising it if it doesn't already exist
`private ResourceBundle` | `getLocalisedResources()`
`private ResourceBundle` | `getResourceBundleForClass(Class<? extends MsgBase> implementingClass, String className, String shortClassName, Locale currentUserLocale, Map<String,ResourceBundle> localisedResourceMap)` Gets the resource bundle for a particular class
`String` | `lookup(String key, Object... params)` Get the internationalized text, but return key if key is unknown.
`private String` | `obtainString(String key)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### localeToResourceMap

    private static Map<Locale,Map<String,ResourceBundle>> localeToResourceMap

### shaper

    private NumberShaper shaper

  Internationalize numbers

### log

    private static final org.slf4j.Logger log

  The log stream

Constructor Detail

### MsgBase

    protected MsgBase()

  Create a MsgBase object

Method Detail

### lookup

    public String lookup(String key,
                         Object... params)

  Get the internationalized text, but return key if key is unknown.

  Parameters:
    `key` - the format key to internationalize
    `params` - the parameters for the format
  Returns:
    the internationalized text

### obtainString

    private String obtainString(String key)

### getLocalisedResources

    private ResourceBundle getLocalisedResources()

### getResourceBundleForClass

    private ResourceBundle getResourceBundleForClass(Class<? extends MsgBase> implementingClass,
                                                     String className,
                                                     String shortClassName,
                                                     Locale currentUserLocale,
                                                     Map<String,ResourceBundle> localisedResourceMap)

  Gets the resource bundle for a particular class

  Parameters:
    `implementingClass` - the implementing class
    `className` - the class name
    `shortClassName` - the short class name
    `currentUserLocale` - the current user locale
    `localisedResourceMap` - the localised resource map
  Returns:
    the resource bundle for class

### getLazyLocalisedResourceMap

    private Map<String,ResourceBundle> getLazyLocalisedResourceMap(Locale currentUserLocale)

  Gets the localised resource map, initialising it if it doesn't already exist

  Parameters:
    `currentUserLocale` - the current user locale
  Returns:
    the lazy localised resource map

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD