|
From: Tarjei S. <lo...@on...> - 2003-08-19 04:00:24
|
On Mon, Aug 18, 2003 at 11:36:39PM +0200, Alef Arendsen (JTeam) wrote: > I've taken the Configurer approach, but might want to add the Resolver later on... > > Why? > > Tiles includes a Locale specific DefinitionsFactory (I18FactorySet) that loads definition files for different locales just as the ResourceBundleViewResolver does. However, creating both properties-files for the ResourceBundleViewResolver and definition files for the Tiles definitions (one for each language) seems silly... When using the InternalResourceViewResolver localization isn't (as the documentation also says) possible... It would be possible to use InternalResourceViewResolver in this scenario if we let Tiles do all the locale specific definition resolution. If InternalResourceViewResolver is configured to use TilesView as the viewclass then the localization can be delegates to Tiles itself since it provides that possibility through the I18nFactorySet class. One problem with I18FactorySet is that it is hardcoded to get the Locale for the request from the users session. It has nowhere near the kind of flexibility that Spring provides when it comes to this. Therefore it might be necessary to subclass I18nFactorySet and override the getDefinitionsFactoryKey method to use RequestContextUtils to get the locale instead. With this simple touch Tiles can make use of the advanced locale resolution strategies that spring provides. > I didn't run into an app needing different definitions per language, but this might be necessary for some people. Fro now the Configurer will do!! I'm using Tiles to do just this at the moment and I find it highly useful for pages that contains a lot of content that needs to be localized but where it isn't reasonable to put all the content in a ResouceBundle. By simply extending I18nFactorySet and using RequestContextUtils I'm able to make full use of Tiles I18N capabilities. I've attached SpringDefinitionsFactory as an example of how this may be done. -- Tarjei Skorgenes lo...@on... |