net.sf.mmm.util.nls.api
Interface NlsTemplate

All Known Implementing Classes:
AbstractNlsTemplate, NlsTemplateImpl

public interface NlsTemplate

This interface represents the template for an internationalized text that can be translated to a given Locale.
There is no direct factory to create an NlsTemplate as an alternative implementation might take totally different arguments for construction. If you want to use your own implementation of NlsTemplate, you can either directly supply it when creating an NlsMessage or otherwise for localization.

Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
NlsMessage, NlsTemplateResolver, NlsTemplateImpl

Method Summary
 String translate(Locale locale)
          This method translates the represented string for the given locale.
 boolean translate(Locale locale, Map<String,Object> arguments, Appendable buffer, NlsTemplateResolver resolver, NlsDependencies nlsDependencies)
          This method behaves like translate(Locale) but additionally fills the given arguments into the translated message writing into the given buffer.
 

Method Detail

translate

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).

translate

boolean translate(Locale locale,
                  Map<String,Object> arguments,
                  Appendable buffer,
                  NlsTemplateResolver resolver,
                  NlsDependencies nlsDependencies)
                  throws IOException
This method behaves like translate(Locale) but additionally fills the given arguments into the translated message writing into the given buffer.

Parameters:
locale - is the locale to translate to.
arguments - are the variable arguments to fill in the message.
buffer - is the buffer where the translation will be appended to.
resolver - is the NlsTemplateResolver.
nlsDependencies - are the NlsDependencies.
Returns:
true if the (translated) message has been appended to the given messageBuffer or false if the translation failed.
Throws:
IOException - if the given Appendable caused such exception.


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