$URL: svn+ssh://alci@svn.forge.objectweb.org/svnroot/barracudamvc/Barracuda2/tags/2.1/WEB-INF/src_docs/architecture/localization/index.html $ - $Revision: 158 $
Put all your content below this line

Localization

The Barracuda Presentation Framework offers a number of features to make localization easy by leveraging the value of XMLC. Barracuda provides a custom Ant taskdef, which extends the Xmlc taskdef, that automatically localizes XMLC templates.

For instance, let's say you have an XMLC template called Foo.html which typically gets compile to FooHTML.class. The Barracuda Localization taskdef looks for the presence of .properties files that contain localized text for a given template. For instance, if we had a Foo.properties (which identifies the text to be localized) and a Foo_es.properties (which contains the localized text in Spanish) the localization taskdef will automatically create a FooHTML_es.class as well. This means that you can quickly localize static text in your app simply by creating .properties file for each locale we wish to support. The templates themselves remain untouched.

Once we have all this different localized templates, the next question is how do we access them? Barracuda provides a DefaultDOMLoader that will load templates based on template name plus target locale. Let's reconsider the example above. If I ask the DOMLoader to get me the FooHTML template for the Spanish locale, it will return an instance of FooHTML_es.class. If I request the template for the German locale, it will return an instance of FooHTML.class, since FooHTML_de.class does not exist. The whole system works very similarly to Java's ResourceBundle utility, and makes it very easy to support multiple locales with very little additional coding.

Barracuda also makes it easy to determine a client's target locale and automatically persist that information across multiple requests. For a more detailed understanding of the localization features in Barracuda, look at the Hello Localized World example.


Put all your content above this linee

$Date: 2007-02-03 14:24:13 +0100 (sam, 03 fév 2007) $