Class I18n

java.lang.Object
org.apache.struts2.components.Component
org.apache.struts2.components.I18n

public class I18n extends Component
Gets a resource bundle and place it on the value stack. This allows the text tag to access messages from any bundle, and not just the bundle associated with the current action.
  • name* - the resource bundle's name (eg foo/bar/customBundle)

Example:

 

 <s:i18n name="myCustomBundle">
    The i18n value for key aaa.bbb.ccc in myCustomBundle is <s:property value="text('aaa.bbb.ccc')" />
 </s:i18n>

 
 
 

 <s:i18n name="some.package.bundle" >
      <s:text name="some.key" />
 </s:i18n>

 
 
  • Field Details

    • pushed

      protected boolean pushed
    • name

      protected String name
  • Constructor Details

  • Method Details

    • setLocalizedTextProvider

      public void setLocalizedTextProvider(LocalizedTextProvider localizedTextProvider)
    • setTextProvider

      public void setTextProvider(TextProvider textProvider)
    • setTextProviderFactory

      public void setTextProviderFactory(TextProviderFactory textProviderFactory)
    • setLocaleProviderFactory

      public void setLocaleProviderFactory(LocaleProviderFactory localeProviderFactory)
    • start

      public boolean start(Writer writer)
      Description copied from class: Component
      Callback for the start tag of this component. Should the body be evaluated?
      Overrides:
      start in class Component
      Parameters:
      writer - the output writer.
      Returns:
      true if the body should be evaluated
    • end

      public boolean end(Writer writer, String body) throws StrutsException
      Description copied from class: Component
      Callback for the end tag of this component. Should the body be evaluated again?
      NOTE: will pop component stack.
      Overrides:
      end in class Component
      Parameters:
      writer - the output writer.
      body - the rendered body.
      Returns:
      true if the body should be evaluated again
      Throws:
      StrutsException
    • setName

      public void setName(String name)