net.sf.jeters.util
Class AssistedTranslatable

java.lang.Object
  extended by net.sf.jeters.util.AssistedTranslatable
All Implemented Interfaces:
Translatable
Direct Known Subclasses:
FileIO, UserIO

public class AssistedTranslatable
extends java.lang.Object
implements Translatable

superclass easing internationalization for its subclasses. Subclasses will not have to implement the methods of the Translatable interface themselves and can simply access language-specific strings by calling str("myStringKey"). Strings with parameters can be accessed using the second str-method (with varargs).

For instructions on creating and naming language ressource files, see Translatable.

The functionality from this class is also included in AssistedComponent.

Author:
Tobias Knerr

Constructor Summary
AssistedTranslatable()
           
 
Method Summary
 void setLanguageResourceBundle(java.util.ResourceBundle langRB)
          sets the ResourceBundle that contains the messages to use
protected  java.lang.String str(java.lang.String key)
          returns the language-specific string identified by the given key
protected  java.lang.String str(java.lang.String key, java.lang.Object... arguments)
          returns the language-specific string identified by the given key and replaces placeholders ({0}, {1}, ...) in the string with the arguments
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssistedTranslatable

public AssistedTranslatable()
Method Detail

setLanguageResourceBundle

public void setLanguageResourceBundle(java.util.ResourceBundle langRB)
Description copied from interface: Translatable
sets the ResourceBundle that contains the messages to use

Specified by:
setLanguageResourceBundle in interface Translatable
Parameters:
langRB - ResourceBundle to retrieve Strings from

str

protected java.lang.String str(java.lang.String key)
returns the language-specific string identified by the given key

Parameters:
key - string identifier used in the properties files
Returns:
string associated with key

str

protected java.lang.String str(java.lang.String key,
                               java.lang.Object... arguments)
returns the language-specific string identified by the given key and replaces placeholders ({0}, {1}, ...) in the string with the arguments

Parameters:
key - string identifier used in the properties files
arguments - object whose .toString() output is used to replace placeholders in the string
Returns:
string associated with key, with placeholders replaced with arguments