org.nuiton.web.struts2
Class I18nTextProvider

java.lang.Object
  extended by org.nuiton.web.struts2.I18nTextProvider
All Implemented Interfaces:
com.opensymphony.xwork2.ResourceBundleTextProvider, com.opensymphony.xwork2.TextProvider

public class I18nTextProvider
extends Object
implements com.opensymphony.xwork2.ResourceBundleTextProvider

Struts2's TextProvider implementation using nuiton's i18n. To use this text provider add the two following lines in your strust.xml :

 <bean class="org.nuiton.web.struts2.I18nTextProvider" name="i18nTextProvider" type="com.opensymphony.xwork2.TextProvider" />
    <constant name="struts.xworkTextProvider" value="i18nTextProvider" />
 

Since:
1.3
Author:
Arnaud Thimel

Field Summary
protected  com.opensymphony.xwork2.LocaleProvider localeProvider
           
static String UNTRANSLATED_MARKER
           
 
Constructor Summary
I18nTextProvider()
           
 
Method Summary
protected  String getSafeText(String key, String value)
           
 String getText(String aTextName)
           
 String getText(String aTextName, List<?> args)
           
 String getText(String aTextName, String defaultValue)
           
 String getText(String key, String[] args)
           
 String getText(String aTextName, String defaultValue, List<?> args)
           
 String getText(String key, String defaultValue, List<?> args, com.opensymphony.xwork2.util.ValueStack stack)
           
 String getText(String aTextName, String defaultValue, String obj)
           
 String getText(String key, String defaultValue, String[] args)
           
 String getText(String key, String defaultValue, String[] args, com.opensymphony.xwork2.util.ValueStack stack)
           
protected  String getTextFromLocale(String key, String defaultValue)
           
protected  String getTextFromLocale(String key, String defaultValue, Object... args)
           
 ResourceBundle getTexts()
           
 ResourceBundle getTexts(String bundleName)
           
 boolean hasKey(String key)
           
 void setBundle(ResourceBundle bundle)
           
 void setClazz(Class clazz)
           
 void setLocaleProvider(com.opensymphony.xwork2.LocaleProvider localeProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNTRANSLATED_MARKER

public static final String UNTRANSLATED_MARKER
See Also:
Constant Field Values

localeProvider

protected com.opensymphony.xwork2.LocaleProvider localeProvider
Constructor Detail

I18nTextProvider

public I18nTextProvider()
Method Detail

getSafeText

protected String getSafeText(String key,
                             String value)

setBundle

public void setBundle(ResourceBundle bundle)
Specified by:
setBundle in interface com.opensymphony.xwork2.ResourceBundleTextProvider

setClazz

public void setClazz(Class clazz)
Specified by:
setClazz in interface com.opensymphony.xwork2.ResourceBundleTextProvider

setLocaleProvider

public void setLocaleProvider(com.opensymphony.xwork2.LocaleProvider localeProvider)
Specified by:
setLocaleProvider in interface com.opensymphony.xwork2.ResourceBundleTextProvider

hasKey

public boolean hasKey(String key)
Specified by:
hasKey in interface com.opensymphony.xwork2.TextProvider

getTextFromLocale

protected String getTextFromLocale(String key,
                                   String defaultValue)

getTextFromLocale

protected String getTextFromLocale(String key,
                                   String defaultValue,
                                   Object... args)

getText

public String getText(String aTextName)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String aTextName,
                      String defaultValue)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String aTextName,
                      String defaultValue,
                      String obj)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String aTextName,
                      List<?> args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String key,
                      String[] args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String aTextName,
                      String defaultValue,
                      List<?> args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String key,
                      String defaultValue,
                      String[] args)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String key,
                      String defaultValue,
                      List<?> args,
                      com.opensymphony.xwork2.util.ValueStack stack)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getText

public String getText(String key,
                      String defaultValue,
                      String[] args,
                      com.opensymphony.xwork2.util.ValueStack stack)
Specified by:
getText in interface com.opensymphony.xwork2.TextProvider

getTexts

public ResourceBundle getTexts(String bundleName)
Specified by:
getTexts in interface com.opensymphony.xwork2.TextProvider

getTexts

public ResourceBundle getTexts()
Specified by:
getTexts in interface com.opensymphony.xwork2.TextProvider


Copyright © 2010-2011 CodeLutin. All Rights Reserved.