translator
Class ExtendedResourceBundle

java.lang.Object
  extended by translator.ExtendedResourceBundle

public class ExtendedResourceBundle
extends java.lang.Object

A special type of PropertyResourceBundle support

Version:
1.1 2000-01-11
Author:
Guido Rößling ( roessling@acm.org)

Field Summary
static java.lang.String ASCII_FORMAT
           
(package private)  java.util.PropertyResourceBundle bundle
          The property resource bundle used for storing the current resources
(package private)  java.util.Vector<ExtendedResourceBundle> componentBundles
           
static java.lang.String PROPERTY_FORMAT
           
 
Constructor Summary
ExtendedResourceBundle(java.lang.String filename)
          Generate a new bundle from the given name and language code
ExtendedResourceBundle(java.lang.String filename, java.lang.String formatName)
          Generate a new bundle from the given name and language code
 
Method Summary
 java.lang.String[] getKeys()
          Retrieve the keys of this resource
 java.lang.String getMessage(java.lang.String key)
          Convenvience wrapper for retrieving the message for key 'key' Internally invokes getMessage(key, true)
 java.lang.String getMessage(java.lang.String key, boolean warnOnError)
          Method for retrieving the message for key 'key'
 Translator getTranslator()
          retrieves the actual Translator instance to be used
 void printProperties()
          Print the properties stored in the bundle to System.out
 void printProperties(java.io.PrintStream outputStream)
          Print the properties stored in the bundle to System.out
 void setTranslator(Translator trans)
          assigns the current Translator for this resource bundle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCII_FORMAT

public static final java.lang.String ASCII_FORMAT
See Also:
Constant Field Values

PROPERTY_FORMAT

public static final java.lang.String PROPERTY_FORMAT
See Also:
Constant Field Values

bundle

java.util.PropertyResourceBundle bundle
The property resource bundle used for storing the current resources


componentBundles

java.util.Vector<ExtendedResourceBundle> componentBundles
Constructor Detail

ExtendedResourceBundle

public ExtendedResourceBundle(java.lang.String filename)
Generate a new bundle from the given name and language code

Parameters:
filename - the file name

ExtendedResourceBundle

public ExtendedResourceBundle(java.lang.String filename,
                              java.lang.String formatName)
Generate a new bundle from the given name and language code

Parameters:
filename - the file name
formatName - the name of the chosen format
Method Detail

getKeys

public java.lang.String[] getKeys()
Retrieve the keys of this resource

Returns:
a String[] of all keys in this resource

getMessage

public java.lang.String getMessage(java.lang.String key)
Convenvience wrapper for retrieving the message for key 'key' Internally invokes getMessage(key, true)

Parameters:
key - the key of the message to retrieve
Returns:
the retrieved message or null, if no message was found
See Also:
getMessage(String, boolean)

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   boolean warnOnError)
Method for retrieving the message for key 'key'

Parameters:
key - the key of the message to retrieve
warnOnError - if true, display a warning on System.out if no appropriate resource was found.
Returns:
the retrieved message or null, if no message was found

getTranslator

public Translator getTranslator()
retrieves the actual Translator instance to be used


printProperties

public void printProperties()
Print the properties stored in the bundle to System.out


printProperties

public void printProperties(java.io.PrintStream outputStream)
Print the properties stored in the bundle to System.out


setTranslator

public void setTranslator(Translator trans)
assigns the current Translator for this resource bundle

Parameters:
trans - the translator to be used. If null, a default translator is used.