Here is an example from a JSP:

            <%-- use access control --%>
            <div class="use_access_control_entry checkbox">
<h2><s:text name="access_control.access_control.use_access_control.label"/></h2>

              <span class="description">
<s:text name="access_control.access_control.use_access_control.description"/>
              </span>
                <s:checkbox
                   name="useAccessControl"
                   value="%{configuration.getBoolean('use_access_control')}"
                   required="false"
                   labelposition="left"
label="% {getText('access_control.access_control.use_access_control.label')}"/>
            </div>

In this example, "s<text name="..."/>" and getText('...') access resource bundles.

For this example to work correctly, there must be a way to resolve the <s:text> and getText() values. In my case, there is a set of resource bundles specifically associated the action, in this case the Action that is the model for this view is named AccessControlAction, so the resource bundles are named AccessControlAction_[XX].properties, and live alongside the AccessControlAction.class file. Further, the bundle for English is named AccessControlAction_en.properties, Spanish AccessControlAction_es.properties, and so forth or each language.


On Apr 24, 2009, at 9:37 AM, Dave Newton wrote:

Johnson nickel wrote:
I want to know about struts 2 localization.  I have seen the
struts 2 documentation i'm not getting clear idea. Can anybody
> provide the basic steps for implementing this localization concept.

Provide a package.properties file for package-level messages. Provide (actionName).properties file for action-specific messages, where (actionName) is either the name of an action, and action superclass, and interface, or interface superclass. You can also define app-wide message resource files using the constant mentioned in the documentation.

Use getText() variants or the I18N tags to retrieve the messages in the JSP files.

That's about it; if you can provide some feedback as to what was confusing we'll update the docs.

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



======

Terry Gardner
terry.gard...@sun.com
Skype: Terry_J_Gardner

"Vulcans never bluff." -- Spock


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to