net.sf.mmm.util.nls.base
Class NlsTemplateImpl

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractLoggableObject
      extended by net.sf.mmm.util.nls.base.AbstractNlsTemplate
          extended by net.sf.mmm.util.nls.base.NlsTemplateImpl
All Implemented Interfaces:
NlsTemplate

public class NlsTemplateImpl
extends AbstractNlsTemplate

This class is the implementation of the NlsTemplate interface. It uses ResourceBundles for localization.

Since:
2.0.0 (moved, 1.0.0)
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  String key
           
private  String name
           
 
Constructor Summary
NlsTemplateImpl(String name, String key)
          The constructor.
 
Method Summary
 String getKey()
          This method gets the key of the string to lookup from the bundle.
 String getName()
          This method gets the base-name used to lookup the bundle (typically a ResourceBundle).
 String toString()
          
 String translate(Locale locale)
          This method translates the represented string for the given locale.
 
Methods inherited from class net.sf.mmm.util.nls.base.AbstractNlsTemplate
createFormatter, translate
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private final String name
See Also:
getName()

key

private final String key
See Also:
getKey()
Constructor Detail

NlsTemplateImpl

public NlsTemplateImpl(String name,
                       String key)
The constructor.

Parameters:
name - is the name of the bundle.
key - is the key of the string to lookup in the bundle.
Method Detail

getName

public String getName()
This method gets the base-name used to lookup the bundle (typically a ResourceBundle).

Returns:
the bundleName is the base-name of the associated bundle.

getKey

public String getKey()
This method gets the key of the string to lookup from the bundle. The key is a technical UID like (ERR_VALUE_OUT_OF_RANGE).

Returns:
the bundleKey is the key used to lookup the string from the bundle.

translate

public String translate(Locale locale)
This method translates the represented string for the given locale.
This typically happens via a lookup in a ResourceBundle).

Parameters:
locale - is the locale to translate to.
Returns:
the resolved string (closest translation for the given locale).

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2001-2010 mmm-Team. All Rights Reserved.