xwork / docs / localisation.html

Full commit
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" lang="en_US" xml:lang="en_US">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <title>OpenSymphony Wiki (Offline Version) :: Xwork Documentation</title>
  <link type="text/css" href="main.css" rel="STYLESHEET"/>
  <div id="page-logo">
    <a href="index.html">XWork Documentation</a>
    <div class="snip-title">
	  <h1 class="snip-name">Localization with XWork
<div id="snip-content" class="snip-content">

 <div class="snip-attachments"></div>
 <h3 class="heading-1">ActionSupport.getText() and LocalizedTextUtil</h3><p class="paragraph"/>The implementation of com.opensymphony.xwork.LocaleAware in com.opensymphony.xwork.ActionSupport uses com.opensymphony.xwork.util.LocalizedTextUtil to find localized message texts for message keys. LocalizedTextUtil uses a system of defaults for finding resource bundle property files for searching for the message text. If LocalizedTextUtil.findText(Class aClass, String aTextName, Locale locale) is called (or LocalizedTextUtil.findText(Class aClass, String aTextName), which just uses the Locale from ActionContext.getContext.getLocale()), the following search order is used:
<li>The class name is used with the call <div class="code"><pre>ResourceBundle.getBundle(aBundleName, locale, <span class="java&#45;object">Thread</span>.currentThread().getContextClassLoader())</pre></div></li>
<li>If the message text is not found, each parent class of the action is used as above until java.lang.Object is found</li>
<li>If the message text has still not been found, findDefaultText(aTextName, locale) is called to search the default message bundles</li>
</ol><p class="paragraph"/>The findDefaultText(aTextName, locale) method searches named resource bundles which have been registered with LocalzedTextUtil in reverse order of their registration (i.e. the first resource bundle name registered is the last to be searched). By default, one default resource bundle name is registered with LocalizedTextUtil for search, "com/opensymphony/xwork/xwork-messages", which is bundled with the jar file to provide system-level message texts.