net.xoetrope.xui.helper
Class XDefaultTranslator

java.lang.Object
  extended by net.xoetrope.xui.helper.XDefaultTranslator
All Implemented Interfaces:
XTranslator

public class XDefaultTranslator
extends java.lang.Object
implements XTranslator

The default implementation of the XTranslator interface, providing simplified lookup of strings in the resource bundle and some independance of the individual resource bundle

Copyright (c) Xoetrope Ltd., 2002-2005

$Revision: 1.1 $

License: see License.txt


Field Summary
protected  XProject currentProject
           
protected  java.util.ResourceBundle languageResourceBundle
           
 
Constructor Summary
XDefaultTranslator(XProject project)
          Creates a new instance of XDefaultTranslator
 
Method Summary
 void setResourceBundle(java.util.ResourceBundle bundle)
          Set the resource bundle for this translator.
 java.lang.String translate(java.lang.String key)
          Look up the translation of a key using the current language resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

languageResourceBundle

protected java.util.ResourceBundle languageResourceBundle

currentProject

protected XProject currentProject
Constructor Detail

XDefaultTranslator

public XDefaultTranslator(XProject project)
Creates a new instance of XDefaultTranslator

Method Detail

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle bundle)
Set the resource bundle for this translator. If the resource bundle implements the ResourceBundleEx then some mapping of the font can occur depending upon what is specified in the associated .property_encoding file.

Specified by:
setResourceBundle in interface XTranslator
Parameters:
bundle - the translation resource bundle

translate

public java.lang.String translate(java.lang.String key)
Look up the translation of a key using the current language resource. If the translation is not found the key value is returned.

Specified by:
translate in interface XTranslator
Parameters:
key - the key string
Returns:
the translation