tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Wilkinson" ...@dealsqueal.com>
Subject Re: Tiles2 Localization
Date Wed, 23 May 2007 11:38:45 GMT
Thank you Antonio!
Your comments were very helpful.

For clarity in the thread - Tiles will read the locale form a session
attribute with the same name as the LOCALE_KEY constant.  I was able to
set this and it worked fine.

The Locale object has parameters language and country, as well as a third
parameter - 'variant' which it will append when resolving the locale.  By
specifying my own convention within the variant, i was able to create
customized locales such as - en_US_state_city (where "_state_city" is the
variant), and tiles would load a defs file named
tiles-defs_en_US_state_city.xml .  However I do have one follow-up
question - tiles only seems to 'cascade' the definitions from the general
tiles-defs.xml and the specific locale file.  I have templates and content
that may apply to a whole state, and would like to override on multiple
levels: tiles-defs.xml -> tiles-defs_en_US_state.xml ->
tiles-defs_en_US_state_city.xml

Where does the loading of the defs files take place?

Thanks again!

> 2007/5/22, Todd Wilkinson <lp@dealsqueal.com>:
>> I would like to be able to localize beyond just language and country.
>> Ideally, I would like to have up to 3 additional criteria on which to
>> localize - eg, state, county, etc.  Is this possible in tiles?
>
> It's possible, but you have to code a bit :-)
> You have to extend the UrlDefinitionFactory class and then configure it.
> As an example, you can see Dimensions:
> http://mutidimensions.sf.net/
> You've got to download the trunk from the Subversion repository.
> Notice that it probably won't build, but at least you'll get the point
> :-)
> http://mutidimensions.svn.sourceforge.net/mutidimensions/framework/trunk/
>
>> I have viewed the tiles localization documentation page here :
>> http://tiles.apache.org/tutorial/advanced/l10n.html
>>
>> I don't quite understand how tiles knows which convention to follow:
>
> It follows the standard for Locales. See:
> http://java.sun.com/developer/technicalArticles/Intl/IntlIntro/
>
>> also, it is unclear to me how the runtime decides the locale to choose -
>> ie, how does tiles know the locale of the request?
>
> See DefaultLocaleResolver class for this:
> http://tiles.apache.org/framework/apidocs/org/apache/tiles/locale/impl/DefaultLocaleResolver.html
>
> HTH
> Antonio
>



Mime
View raw message