JavaScud | Forum | JIRA | Blog |
  Dashboard > WebWork2文档中文化计划 > ... > Interceptors > I18n Interceptor
  WebWork2文档中文化计划 Log In View a printable version of the current page.  
  I18n Interceptor
Added by scud, last edited by scud on May 19, 2006  (view change)
Labels: 
(None)

这个拦截器负责把session中指定的区域设置为当前请求的区域设置.并且这个拦截器还会根据请求中的参数来改变区域设置.这就说你可以用来动态的改变用户Session中区域设置.这对于实现多语言支持并允许用户在任何时候更改语言很有用. 区域设置参数在这个拦截器执行的时候会被删除,以确保action中相应的属性不会被设置(例如request_locale).

例如,使用默认的参数,一个像foo.action?request_locale=en_US这样的请求就可以把US English作为区域设置保存到用户的Session中,以便被将来的请求所使用.

参数

  • parameterName (可选) - HTTP请求参数的名字,表示要切换和保存到Session的区域设置.默认是request_locale
  • attributeName (可选) - Session中用来存放区域设置的Key的名字,默认是WW_TRANS_I18N_LOCALE

扩展

Examples

<action name="someAction" class="com.examples.SomeAction">
    <interceptor-ref name="i18n"/>
    <interceptor-ref name="basicStack"/>
    <result name="success">good_result.ftl</result>
</action>
Site running on a free Atlassian Confluence Open Source Project License granted to WebWork China. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.3 Build:#808 May 29, 2007) - Bug/feature request - Contact Administrators