net.sf.sfac.lang
Class MultiLingualDirectText

java.lang.Object
  extended by net.sf.sfac.lang.MultiLingualDirectText
All Implemented Interfaces:
MultiLingualText

public class MultiLingualDirectText
extends Object
implements MultiLingualText

Implementation of the MultiLingualText interface holding all possible translations in a Map.

Author:
Olivier Berlanger

Constructor Summary
MultiLingualDirectText(String defaultText)
           
 
Method Summary
 void add(String localeId, String text)
           
 Iterator<String> getAvailableLocaleIds()
           
 String getText()
          Get the value of the text for the default locale.
 String getText(Locale loc)
          Get the value of the text for the specified locale.
 String getText(String localeId)
          Get the value of the text for the specified locale.
 void remove(String localeId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLingualDirectText

public MultiLingualDirectText(String defaultText)
Method Detail

add

public void add(String localeId,
                String text)

remove

public void remove(String localeId)

getText

public String getText()
Description copied from interface: MultiLingualText
Get the value of the text for the default locale.

Specified by:
getText in interface MultiLingualText
Returns:
the value of the text for the default locale.

getText

public String getText(Locale loc)
Description copied from interface: MultiLingualText
Get the value of the text for the specified locale.
If a specific value for the given locale is not available, this method tries to find the most appropriate translation with the usual ResourceBundle mechanism.

Specified by:
getText in interface MultiLingualText
Returns:
the value of the text for the specified locale.

getText

public String getText(String localeId)
Description copied from interface: MultiLingualText
Get the value of the text for the specified locale.
If a specific value for the given locale is not available, this method tries to find the most appropriate translation with the usual ResourceBundle mechanism.

Specified by:
getText in interface MultiLingualText
Parameters:
localeId - the ID of the locale (language_country_variant)
Returns:
the value of the text for the specified locale.

getAvailableLocaleIds

public Iterator<String> getAvailableLocaleIds()


Copyright © 2012. All Rights Reserved.