org.objectweb.telosys.uil.i18n
Class StandardTranslator

java.lang.Object
  extended byorg.objectweb.telosys.common.TelosysObject
      extended byorg.objectweb.telosys.uil.i18n.StandardTranslator
All Implemented Interfaces:
Translator

public class StandardTranslator
extends TelosysObject
implements Translator

This class is the standard implementation of the Translator interface.
There's one instance of this class for "screen/renderer" file having a translation ( ".jsp" files )
It contains all the translations (in all languages) for this "screen/renderer"


Field Summary
protected  java.util.HashMap _dict
           
protected static java.lang.String SEPARATOR
           
 
Constructor Summary
StandardTranslator()
          The default constructor
 
Method Summary
 boolean isEmpty()
          Returns true if this translator is empty ( contains no keys to translate )
 void load(java.io.InputStream inputStream, java.lang.String sLanguage)
          Loads a language translation from a properties input stream
 int size()
          Returns the dictionary size ( translator entries count )
 java.lang.String translate(java.lang.String sKey, java.lang.String sLanguage)
          Returns the translated text for the given key and the given language
 
Methods inherited from class org.objectweb.telosys.common.TelosysObject
error, error, error, getFlagTrace, info, setFlagTrace, trace, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR

protected static final java.lang.String SEPARATOR
See Also:
Constant Field Values

_dict

protected java.util.HashMap _dict
Constructor Detail

StandardTranslator

public StandardTranslator()
The default constructor

Method Detail

translate

public java.lang.String translate(java.lang.String sKey,
                                  java.lang.String sLanguage)
Description copied from interface: Translator
Returns the translated text for the given key and the given language

Specified by:
translate in interface Translator
Parameters:
sKey - the tag attribute key ( e.g. : "MyTagId.txt")
sLanguage - the language ( e.g. : "fr", "en", "it", ... )
Returns:
the translated text, or null if there's no translation for the given key

size

public int size()
Description copied from interface: Translator
Returns the dictionary size ( translator entries count )

Specified by:
size in interface Translator
Returns:

isEmpty

public boolean isEmpty()
Description copied from interface: Translator
Returns true if this translator is empty ( contains no keys to translate )

Specified by:
isEmpty in interface Translator
Returns:

load

public void load(java.io.InputStream inputStream,
                 java.lang.String sLanguage)
Loads a language translation from a properties input stream

Parameters:
inputStream - : the properties input stream
sLanguage - : the language ISO code ( "fr", "en", .. )