You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tiles.apache.org by Antonio Petrelli <an...@gmail.com> on 2007/02/28 12:37:55 UTC

Getting current Locale strategy

Hi all!
I noticed that we still have no strategy to get the current locale,
except of the locale that the request has.
I think we have two choices:
1) Modifying the TilesRequestContext.getRequestLocale implementations,
so that it tries to take the current locale from the session (the
ComponentConstants.LOCALE_KEY is there but it is never used);
2) Introduce a "LocaleResolver" interface, that has a method that
takes a TilesRequestContext and returns the current Locale. This
resolver will be used (I suppose) only in UrlDefinitionsFactory and
can be configurable.
I prefer the latter option, but I am open to comments and suggestions.

Paul Benedict in the Struts-dev mailing list started a thread about a
similar issue:
http://www.nabble.com/Struts-1.4---2.1-sharing-localization-code-tf3270764.html

Thoughts?

Antonio

Re: Getting current Locale strategy

Posted by Niall Pemberton <ni...@gmail.com>.
On 2/28/07, Antonio Petrelli <an...@gmail.com> wrote:
> Hi all!
> I noticed that we still have no strategy to get the current locale,
> except of the locale that the request has.
> I think we have two choices:
> 1) Modifying the TilesRequestContext.getRequestLocale implementations,
> so that it tries to take the current locale from the session (the
> ComponentConstants.LOCALE_KEY is there but it is never used);
> 2) Introduce a "LocaleResolver" interface, that has a method that
> takes a TilesRequestContext and returns the current Locale. This
> resolver will be used (I suppose) only in UrlDefinitionsFactory and
> can be configurable.
> I prefer the latter option, but I am open to comments and suggestions.
>
> Paul Benedict in the Struts-dev mailing list started a thread about a
> similar issue:
> http://www.nabble.com/Struts-1.4---2.1-sharing-localization-code-tf3270764.html

He also created a patch with some code (based on some Spring stuff)
attached to the following Jira ticket:

https://issues.apache.org/struts/browse/STR-2897

Niall

> Thoughts?
>
> Antonio
>