org.formaria.aria.helper
Class DefaultTranslator

java.lang.Object
  extended by org.formaria.aria.helper.DefaultTranslator
All Implemented Interfaces:
Translator
Direct Known Subclasses:
Translator

public class DefaultTranslator
extends java.lang.Object
implements Translator

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

Copyright (c) Formaria Ltd., 2008

$Revision: 1.1 $

License: see License.txt


Field Summary
protected  Project currentProject
           
protected  java.util.ResourceBundle languageResourceBundle
           
 
Constructor Summary
DefaultTranslator(Project project)
          Creates a new instance of DefaultTranslator
 
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 Project currentProject
Constructor Detail

DefaultTranslator

public DefaultTranslator(Project project)
Creates a new instance of DefaultTranslator

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 Translator
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 Translator
Parameters:
key - the key string
Returns:
the translation