ehsbe CommonsTM
Version 1.1.0rc3

com.ehsbe.commons.gui.wizard
Interface Translator

All Known Implementing Classes:
TranslatorAdapter

public interface Translator

A more or less simple "dictionary", which lets one lookup i18n strings.

Implementation could make use of a HashMap, a ResourceBundle or whatever seems to be appropriate.

Version:
$Revision: 488 $
Author:
Jens Elkner

Method Summary
 Locale getLocale()
          Get the locale currently used for translations.
 void setLocale(Locale locale)
          Set the locale, which should be use for translations.
 String xlate(String prefix, String name)
          Translate the given name wrt. to the given prefix.
 

Method Detail

setLocale

void setLocale(Locale locale)
Set the locale, which should be use for translations.

Parameters:
locale - Locale to set. If null, the default locale should be used.
See Also:
Locale.getDefault()

getLocale

Locale getLocale()
Get the locale currently used for translations.

Returns:
null if not set and default locale is used, the locale in use otherwise.

xlate

String xlate(String prefix,
             String name)
Translate the given name wrt. to the given prefix. E.g. one may form the lookup key wrt. a ResourceBundle or HashMap by a simple concatenation of the prefix and the name.

One should never let an exception pass or throw here. Instead catch and log.

Parameters:
prefix - key prefix. Usually a purpose indicator.
name - key name. Usually an instance ID.
Returns:
a translation (might be null).

ehsbe CommonsTM
Version 1.1.0rc3

Copyright ©2005-2009 EHSBE, Walther-Rathenau-Str. 58, 39104 Magdeburg, Sachsen-Anhalt, Germany. All Rights Reserved.