Re: How to call locale properties file based on urls

2013-02-12 Thread karthi
I am now using ThreadLocale service.
Everythings works perfectly!! 
Now no need to worry for css files!

Many thanks Lance Java  others for kind help.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719968.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-11 Thread Lance Java
There's been multiple suggestions on solving this problem so it's best if you
answer a few questions:
1. What approach have you taken? (RequestFilter, ComponentRequestFilter or
ComponentEventLinkEncoder)
2. Are you setting the locale on the PersistantLocale or the ThreadLocale
service
3. Are your URL's of the form de.club.mobi/Club or www.club.mobi/de/Club?

FYI tapestry should fall back to the default CSS if a language specific file
is not available.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719927.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-11 Thread karthi
PersistantLocale  the url of the form www.club.mobi/de/Club



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719928.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-11 Thread Lance Java
Ah, so you're using tapestry's built in localization support. How are you
referencing your CSS file?. You should use the context: binding to access
assets in src/main/webapp/.

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



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719929.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-11 Thread karthi
Thank you



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719930.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-10 Thread karthi
Thanks for your replies.. I've done.

I have kept multiple properties file under the app name for multiple
languages  tml pages also.  

My properties, tml pages loaded as per the language, However the css files
are not loading?

I've kept css in this structure:

My deployment path is src/main/webapp under that

I have -- layout/images/

   -- layout/css files, js files etc.,

When checked using firebug, found that my css call changed 
from href=layout/styles.css 
to href=de/layout/styles.css

Is this correct? Do I have to create multiple language style sheets also?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719924.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
Tapestry has built in support for including the language in the URL. If you
set the locale on the PersistentLocale service, the first folder in the URL
will be the language http://tapestry.apache.org/localization.html

There is also a ThreadLocale service which is ultimately used for message
lookup. If you want your own custom logic then I suggest that you contribute
a RequestFilter to the RequestHandler service. The RequestFilter will set
the locale on ThreadLocale by inspecting the Request. It's probably best to
contribute your filter before:*



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719865.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread karthi
Thanks for your reply.

the first folder in the URL will be the language?

Here, Can't understand? could you elaborate?

If my called url is de.club.mobi/club 
then will my club_de.properties invoke automatically?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719866.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread karthi
One more question:

You said: If you set the locale on the PersistentLocale service

How to set PersistentLocale service?

I just tried to inject in my page but it doesn't gives any effect rather it
throws null pointer exception.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719867.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
Tapestry's built in language support is as follows
www.myserver.com/Clubs - persistant locale is null
www.myserver.com/de/Clubs - persistant locale is de

If you are happy enough with that then use the built in support. If not, use
my second suggestion.





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719868.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
All of the services I mentioned (PersistantLocale, ThreadLocale, Request and
RequestHandler) are tapestry managed services. I suggest you familiarize
yourself with tapestry IOC

http://tapestry.apache.org/defining-tapestry-ioc-services.html
http://tapestry.apache.org/tapestry-ioc-configuration.html



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719869.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread René Bernhardsgrütter
Hi karthi and Lance Java,

@karthi, if you try the second solution and it doesn't work as expected,
try it with ComponentRequestFilter instead of RequestFilter. I had there
a tricky problem this week, see here:
https://mail-archives.apache.org/mod_mbox/tapestry-users/201302.mbox/%3c51123b7f.20...@gmail.com%3E

I didn't want to use the url solution, now I store the locale
information in a cookie.

René

On 08.02.2013 12:10, Lance Java wrote:
 Tapestry has built in support for including the language in the URL. If you
 set the locale on the PersistentLocale service, the first folder in the URL
 will be the language http://tapestry.apache.org/localization.html

 There is also a ThreadLocale service which is ultimately used for message
 lookup. If you want your own custom logic then I suggest that you contribute
 a RequestFilter to the RequestHandler service. The RequestFilter will set
 the locale on ThreadLocale by inspecting the Request. It's probably best to
 contribute your filter before:*



 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719865.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

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



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



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
René, tapestry also supports locale specific assets (eg images) so a
ComponentRequestFilter is too late in the request-processing pipeline
(http://tapestry.apache.org/request-processing.html).

I think your main problem is that you have contributed your localeFilter
after:* so it won't run until after all of the components have rendered
which is pretty useless. If you contribute it before:* I assume it would
work.

Also, in your code, I can see a few problems:

1. You have not specified an interface in you bind methods

eg:
public static void bind(ServiceBinder binder) {
   binder.bind(TimingFilter.class).withId(TimingFilter);
   binder.bind(LocaleRequestFilter.class).withId(LocaleRequestFilter);
}

should be:
public static void bind(ServiceBinder binder) {
   binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();
   binder.bind(RequestFilter.class,
LocaleRequestFilter.class).withSimpleId();
}

2. You inject services but never use them

eg:
public void contributeRequestHandler(OrderedConfigurationRequestFilter
configuration,
   final Logger logger,
   final RequestGlobals requestGlobals,
   final Cookies cookies,
   final LocalizationSetter localizationSetter,
   @InjectService(TimingFilter) RequestFilter timingFilter,
   @InjectService(LocaleRequestFilter) RequestFilter localeRequestFilter)
{
  configuration.add(TimingFilter, new TimingFilter(logger));
  configuration.add(LocaleRequestFilter, new
LocaleRequestFilter(requestGlobals, cookies, localizationSetter),
after:*);
}

should be:
public void contributeRequestHandler(OrderedConfigurationRequestFilter
configuration,
   final Logger logger,
   final RequestGlobals requestGlobals,
   final Cookies cookies,
   final LocalizationSetter localizationSetter,
   @InjectService(TimingFilter) RequestFilter timingFilter,
   @InjectService(LocaleRequestFilter) RequestFilter localeRequestFilter)
{
  configuration.add(TimingFilter, timingFilter);
  configuration.add(LocaleRequestFilter, localeRequestFilter,
before:*)
}




--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719871.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread René Bernhardsgrütter
I also contributed the RequestFilter in different phases (before:*,
before:SetupRender, before:BeginRender) because, to me, this should
set the locale before any template is rendered.

But it didn't work. I've tried now again and set the things you said
before. By the way, thanks for the tips :-) . I removed the unnecesary
interfaces and cleaned up after I mailed the, how it worked. It still
doesn't work.


My code now:
public static void bind(ServiceBinder binder) {
binder.bind(AjaxUploadDecoder.class,
AjaxUploadDecoderImpl.class).scope(ScopeConstants.PERTHREAD); // I also
use this, that should not affect the locale
binder.bind(TimingFilter.class).withSimpleId();
binder.bind(LocaleRequestFilter.class).withSimpleId();
}

public static void contributeRequestHandler(
OrderedConfigurationRequestFilter configuration,
@InjectService(TimingFilter) TimingFilter timingFilter,
@InjectService(LocaleRequestFilter) LocaleRequestFilter
localeRequestFilter) {
configuration.add(TimingFilter, timingFilter);
configuration.add(LocaleRequestFilter, localeRequestFilter,
before:*);
}

And the LocaleRequestFilter.java:
public class LocaleRequestFilter implements RequestFilter {

private Cookies cookies;
private LocalizationSetter localizationSetter;

public LocaleRequestFilter(Cookies cookies, LocalizationSetter
localizationSetter) {
this.cookies = cookies;
this.localizationSetter = localizationSetter;
}

@Override
public boolean service(Request request, Response response,
RequestHandler handler) throws IOException {
TranslatedLanguage preferredLanguage;

String languageValueInCookie =
cookies.readCookieValue(PlainTraySetting.COOKIE_LANGUAGE_VALUE_NAME);
// some logic to set the correct locale to prefferedLanguage,
which is an enum.

   
localizationSetter.setLocaleFromLocaleName(preferredLanguage.toString());
return handler.service(request, response);
}
}

On 08.02.2013 12:59, Lance Java wrote:
 René, tapestry also supports locale specific assets (eg images) so a
 ComponentRequestFilter is too late in the request-processing pipeline
 (http://tapestry.apache.org/request-processing.html).

 I think your main problem is that you have contributed your localeFilter
 after:* so it won't run until after all of the components have rendered
 which is pretty useless. If you contribute it before:* I assume it would
 work.

 Also, in your code, I can see a few problems:

 1. You have not specified an interface in you bind methods

 eg:
 public static void bind(ServiceBinder binder) {
binder.bind(TimingFilter.class).withId(TimingFilter);
binder.bind(LocaleRequestFilter.class).withId(LocaleRequestFilter);
 }

 should be:
 public static void bind(ServiceBinder binder) {
binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();
binder.bind(RequestFilter.class,
 LocaleRequestFilter.class).withSimpleId();
 }

 2. You inject services but never use them

 eg:
 public void contributeRequestHandler(OrderedConfigurationRequestFilter
 configuration,
final Logger logger,
final RequestGlobals requestGlobals,
final Cookies cookies,
final LocalizationSetter localizationSetter,
@InjectService(TimingFilter) RequestFilter timingFilter,
@InjectService(LocaleRequestFilter) RequestFilter localeRequestFilter)
 {
   configuration.add(TimingFilter, new TimingFilter(logger));
   configuration.add(LocaleRequestFilter, new
 LocaleRequestFilter(requestGlobals, cookies, localizationSetter),
 after:*);
 }

 should be:
 public void contributeRequestHandler(OrderedConfigurationRequestFilter
 configuration,
final Logger logger,
final RequestGlobals requestGlobals,
final Cookies cookies,
final LocalizationSetter localizationSetter,
@InjectService(TimingFilter) RequestFilter timingFilter,
@InjectService(LocaleRequestFilter) RequestFilter localeRequestFilter)
 {
   configuration.add(TimingFilter, timingFilter);
   configuration.add(LocaleRequestFilter, localeRequestFilter,
 before:*)
 }




 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719871.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

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



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



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
 I also contributed the RequestFilter in different phases (before:*,
before:SetupRender, before:BeginRender) because, to me, this should set
the locale before any template is rendered.
I've never heard of filters named SetupRender or BeginRender so I'm
pretty sure before:SetupRender has no effect.

 I removed the unnecesary interfaces and cleaned up
Interfaces are very necessary!!!. They are crucial to tapestry to support
lazy loading etc. You should NEVER refer to your services by their concrete
type.

eg:
binder.bind(TimingFilter.class).withSimpleId();

Should be:
binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();

eg:
public static void
contributeRequestHandler(OrderedConfigurationRequestFilter configuration,
@InjectService(TimingFilter) TimingFilter timingFilter) {

should be:
public static void
contributeRequestHandler(OrderedConfigurationRequestFilter configuration,
@InjectService(TimingFilter) RequestFilter timingFilter) {

I'm still not sure why your filter doesn't work when contributed before:*.
Have you tried some logging / breakpoints? Are you sure that
ThreadLocale.setLocale() is being called?





--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719873.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
René, I think I've figured out what your problem is. You should not be using
LocalizationSetter as this is backed by the PersistantLocale which is
ultimately responsible for including the language as the first folder in the
URL.

As I said initially, if you want your own custom logic (ie storing in a
cookie) then I suggest you use ThreadLocale instead.



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719874.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread René Bernhardsgrütter
 I've never heard of filters named SetupRender or BeginRender so I'm
 pretty sure before:SetupRender has no effect
I just tried this while I was trying to get it work.

 Interfaces are very necessary!!!. They are crucial to tapestry to support
 lazy loading etc. You should NEVER refer to your services by their concrete
 type.

 Should be:
 binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();
 should be:
 public static void
 contributeRequestHandler(OrderedConfigurationRequestFilter configuration,
 @InjectService(TimingFilter) RequestFilter timingFilter) {;

Ok, I didn't know that.  

Now the code is:

binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();
binder.bind(RequestFilter.class, 
LocaleRequestFilter.class).withSimpleId();

and:

public static void contributeRequestHandler(
OrderedConfigurationRequestFilter configuration,
@InjectService(TimingFilter) RequestFilter timingFilter,
@InjectService(LocaleRequestFilter) RequestFilter 
localeRequestFilter) {
configuration.add(TimingFilter, timingFilter);
configuration.add(LocaleRequestFilter, localeRequestFilter, 
before:*);
}

 René, I think I've figured out what your problem is. You should not be using
 LocalizationSetter as this is backed by the PersistantLocale which is
 ultimately responsible for including the language as the first folder in the
 URL.

I've also changed this, to:

public class LocaleRequestFilter implements RequestFilter {

private Cookies cookies;
private ThreadLocale threadLocale;

public LocaleRequestFilter(Cookies cookies, ThreadLocale threadLocale) {
this.cookies = cookies;
this.threadLocale = threadLocale;
}

@Override
public boolean service(Request request, Response response, RequestHandler 
handler) throws IOException {
TranslatedLanguage preferredLanguage;

String languageValueInCookie = 
cookies.readCookieValue(PlainTraySetting.COOKIE_LANGUAGE_VALUE_NAME);
String languageValueInHttpRequest = request.getLocale().getLanguage();

if (languageValueInCookie != null) {
preferredLanguage = 
TranslatedLanguage.findLanguage(languageValueInCookie);
} else {
preferredLanguage = 
TranslatedLanguage.findLanguage(languageValueInHttpRequest);
}

if (preferredLanguage == null) {
preferredLanguage = PlainTraySetting.DEFAULT_LANGUAGE;
}

if (languageValueInCookie == null) {

cookies.writeCookieValue(PlainTraySetting.COOKIE_LANGUAGE_VALUE_NAME, 
preferredLanguage.toString());
}

System.out.println(set locale to  + new 
Locale(preferredLanguage.toString()).getLanguage());
threadLocale.setLocale(new Locale(preferredLanguage.toString()));
System.out.println(get locale is  + 
threadLocale.getLocale().getLanguage());
return handler.service(request, response);
}
}

I see the output set locale to de and on the next line get locale is de, so 
I'm pretty sure threadLocale.setLocale(...) ran correctly.
But it still doesn't work. I always get the browser locale (English). 


On 08.02.2013 13:58, Lance Java wrote:
 René, I think I've figured out what your problem is. You should not be using
 LocalizationSetter as this is backed by the PersistantLocale which is
 ultimately responsible for including the language as the first folder in the
 URL.

 As I said initially, if you want your own custom logic (ie storing in a
 cookie) then I suggest you use ThreadLocale instead.



 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719874.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.

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



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



Re: How to call locale properties file based on urls

2013-02-08 Thread Taha Siddiqi

Hi

Is this something you are looking for 

http://tawus.wordpress.com/2013/01/07/changing-locale-based-on-domain/

regards
Taha

On Feb 8, 2013, at 7:09 PM, René Bernhardsgrütter wrote:

 I've never heard of filters named SetupRender or BeginRender so I'm
 pretty sure before:SetupRender has no effect
 I just tried this while I was trying to get it work.
 
 Interfaces are very necessary!!!. They are crucial to tapestry to support
 lazy loading etc. You should NEVER refer to your services by their concrete
 type.
 
 Should be:
 binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();
 should be:
 public static void
 contributeRequestHandler(OrderedConfigurationRequestFilter configuration,
 @InjectService(TimingFilter) RequestFilter timingFilter) {;
 
 Ok, I didn't know that.
 
 Now the code is:
 
binder.bind(RequestFilter.class, TimingFilter.class).withSimpleId();
binder.bind(RequestFilter.class, 
 LocaleRequestFilter.class).withSimpleId();
 
 and:
 
public static void contributeRequestHandler(
OrderedConfigurationRequestFilter configuration,
@InjectService(TimingFilter) RequestFilter timingFilter,
@InjectService(LocaleRequestFilter) RequestFilter 
 localeRequestFilter) {
configuration.add(TimingFilter, timingFilter);
configuration.add(LocaleRequestFilter, localeRequestFilter, 
 before:*);
}
 
 René, I think I've figured out what your problem is. You should not be using
 LocalizationSetter as this is backed by the PersistantLocale which is
 ultimately responsible for including the language as the first folder in the
 URL.
 
 I've also changed this, to:
 
 public class LocaleRequestFilter implements RequestFilter {
 
private Cookies cookies;
private ThreadLocale threadLocale;
 
public LocaleRequestFilter(Cookies cookies, ThreadLocale threadLocale) {
this.cookies = cookies;
this.threadLocale = threadLocale;
}
 
@Override
public boolean service(Request request, Response response, RequestHandler 
 handler) throws IOException {
TranslatedLanguage preferredLanguage;
 
String languageValueInCookie = 
 cookies.readCookieValue(PlainTraySetting.COOKIE_LANGUAGE_VALUE_NAME);
String languageValueInHttpRequest = request.getLocale().getLanguage();
 
if (languageValueInCookie != null) {
preferredLanguage = 
 TranslatedLanguage.findLanguage(languageValueInCookie);
} else {
preferredLanguage = 
 TranslatedLanguage.findLanguage(languageValueInHttpRequest);
}
 
if (preferredLanguage == null) {
preferredLanguage = PlainTraySetting.DEFAULT_LANGUAGE;
}
 
if (languageValueInCookie == null) {

 cookies.writeCookieValue(PlainTraySetting.COOKIE_LANGUAGE_VALUE_NAME, 
 preferredLanguage.toString());
}
 
System.out.println(set locale to  + new 
 Locale(preferredLanguage.toString()).getLanguage());
threadLocale.setLocale(new Locale(preferredLanguage.toString()));
System.out.println(get locale is  + 
 threadLocale.getLocale().getLanguage());
return handler.service(request, response);
}
 }
 
 I see the output set locale to de and on the next line get locale is de, 
 so I'm pretty sure threadLocale.setLocale(...) ran correctly.
 But it still doesn't work. I always get the browser locale (English). 
 
 
 On 08.02.2013 13:58, Lance Java wrote:
 René, I think I've figured out what your problem is. You should not be using
 LocalizationSetter as this is backed by the PersistantLocale which is
 ultimately responsible for including the language as the first folder in the
 URL.
 
 As I said initially, if you want your own custom logic (ie storing in a
 cookie) then I suggest you use ThreadLocale instead.
 
 
 
 --
 View this message in context: 
 http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719874.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 



Re: How to call locale properties file based on urls

2013-02-08 Thread Lance Java
Hi Taha, decorating the ComponentEventLinkEncoder should have the same effect
as contributing a ComponentRequestFilter. As I've mentioned in this thread,
tapestry also supports locale specific assets (images, stylesheets etc) so I
feel that a RequestFilter is the correct point of interception for this. Is
there a reason why this cannot be done in a RequestFilter?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/How-to-call-locale-properties-file-based-on-urls-tp5719862p5719879.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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



Re: How to call locale properties file based on urls

2013-02-08 Thread Thiago H de Paula Figueiredo
On Fri, 08 Feb 2013 10:17:57 -0200, René Bernhardsgrütter  
rene.bernhardsgruet...@gmail.com wrote:



I also contributed the RequestFilter in different phases (before:*,
before:SetupRender, before:BeginRender) because, to me, this should
set the locale before any template is rendered.


SetupRender and BeginRender are component rendering event phases. The  
before and after in ordered contributions refer to other contributed  
objects which, in this case, are other RequestFilters.


--
Thiago H. de Paula Figueiredo

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



Re: How to call locale properties file based on urls

2013-02-08 Thread Thiago H de Paula Figueiredo
On Fri, 08 Feb 2013 11:39:13 -0200, René Bernhardsgrütter  
rene.bernhardsgruet...@gmail.com wrote:


Interfaces are very necessary!!!. They are crucial to tapestry to  
support lazy loading etc. You should NEVER refer to your services by  
their concrete type.


This isn't just for Tapestry-IoC or Tapestry or even Java: these are rules  
for any object-oriented code in statically-typed languages. That's the  
Bridge design pattern.


--
Thiago H. de Paula Figueiredo

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