You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by sommeralex <al...@gmail.com> on 2013/02/05 11:49:46 UTC

getting the actual tapestry locale

Hi!

I need to get the (supported) tapestry locale of my page in my page java
class. So first, i have set the locales in my AppModule:

configuration.add("tapestry.supported-locales", "en, de");

then, i give the user the opportunity to switch

void onActionFromDe(){
persistentLocale.set(Locale.GERMAN);
}
	
void onActionFromEn(){
persistentLocale.set(Locale.ENGLISH);		
}

but as long he doesnt switch, the http-request locale is mapped
automatically from tapestry to de or en within a page;

http://tapestry.apache.org/localization.html

what i need is to get the current (tapestry supported locale) of a page -
even if the user did not select a language.


persistentLocale.get() is null, as long as the user did not select a
language. Request r.getLocale() would give me any locale the user currently
has (so even unsupported tapestry locales, right?)

so, how can i get the actual tapestry locale used within a page? the only
hack would be to force the persistentLocale to set for each page..?

thx
 





--
View this message in context: http://tapestry.1045711.n5.nabble.com/getting-the-actual-tapestry-locale-tp5719764.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: getting the actual tapestry locale

Posted by sommeralex <al...@gmail.com>.
thx, perfect.

@Inject

@Property

private Locale currentLocale;


2013/2/5 Geoff Callender-2 [via Tapestry] <
ml-node+s1045711n5719768h50@n5.nabble.com>

> Does this help?
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/localization/bymessagecatalog
>
> Geoff
>
> On 05/02/2013, at 9:49 PM, sommeralex wrote:
>
> > Hi!
> >
> > I need to get the (supported) tapestry locale of my page in my page java
> > class. So first, i have set the locales in my AppModule:
> >
> > configuration.add("tapestry.supported-locales", "en, de");
> >
> > then, i give the user the opportunity to switch
> >
> > void onActionFromDe(){
> > persistentLocale.set(Locale.GERMAN);
> > }
> >
> > void onActionFromEn(){
> > persistentLocale.set(Locale.ENGLISH);
> > }
> >
> > but as long he doesnt switch, the http-request locale is mapped
> > automatically from tapestry to de or en within a page;
> >
> > http://tapestry.apache.org/localization.html
> >
> > what i need is to get the current (tapestry supported locale) of a page
> -
> > even if the user did not select a language.
> >
> >
> > persistentLocale.get() is null, as long as the user did not select a
> > language. Request r.getLocale() would give me any locale the user
> currently
> > has (so even unsupported tapestry locales, right?)
> >
> > so, how can i get the actual tapestry locale used within a page? the
> only
> > hack would be to force the persistentLocale to set for each page..?
> >
> > thx
> >
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/getting-the-actual-tapestry-locale-tp5719764.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719768&i=0>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719768&i=1>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719768&i=2>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=5719768&i=3>
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://tapestry.1045711.n5.nabble.com/getting-the-actual-tapestry-locale-tp5719764p5719768.html
>  To unsubscribe from getting the actual tapestry locale, click here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5719764&code=YWxleGFuZGVyLnNvbW1lckBnbWFpbC5jb218NTcxOTc2NHwxMDUzMzQxMzM4>
> .
> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://tapestry.1045711.n5.nabble.com/getting-the-actual-tapestry-locale-tp5719764p5719775.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: getting the actual tapestry locale

Posted by Geoff Callender <ge...@gmail.com>.
Does this help?

	http://jumpstart.doublenegative.com.au/jumpstart/examples/localization/bymessagecatalog

Geoff

On 05/02/2013, at 9:49 PM, sommeralex wrote:

> Hi!
> 
> I need to get the (supported) tapestry locale of my page in my page java
> class. So first, i have set the locales in my AppModule:
> 
> configuration.add("tapestry.supported-locales", "en, de");
> 
> then, i give the user the opportunity to switch
> 
> void onActionFromDe(){
> persistentLocale.set(Locale.GERMAN);
> }
> 	
> void onActionFromEn(){
> persistentLocale.set(Locale.ENGLISH);		
> }
> 
> but as long he doesnt switch, the http-request locale is mapped
> automatically from tapestry to de or en within a page;
> 
> http://tapestry.apache.org/localization.html
> 
> what i need is to get the current (tapestry supported locale) of a page -
> even if the user did not select a language.
> 
> 
> persistentLocale.get() is null, as long as the user did not select a
> language. Request r.getLocale() would give me any locale the user currently
> has (so even unsupported tapestry locales, right?)
> 
> so, how can i get the actual tapestry locale used within a page? the only
> hack would be to force the persistentLocale to set for each page..?
> 
> thx
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/getting-the-actual-tapestry-locale-tp5719764.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org