Re: Best Practices for PrettyFaces and Multiple language sites

Splash Forums PrettyFaces Users Best Practices for PrettyFaces and Multiple language sites Re: Best Practices for PrettyFaces and Multiple language sites

#20699

icordoba
Participant

Hi domdorn,

thanks for that approach. I think that you really don’t need that filter. I use a named class (userSessionView) which has a setLanguage() method. In content pages I want to use with PrettyFaces I do:

/#{ /en/ language : userSessionView.language }

and so the language is set for the request. The goal is the same as with your filter, but with one difference. i don’t want to use permanent links in all pages. Just the ones that show content (doc pages, blog entries, home, …) but not, for example, in the control panel of the site, which is authentified and i want it to work as regular JSF application (I want the user to set the locale in his preferences and have it the “sessionScoped” approach). With the filter, you get every request to go through it, with the dynamic pattern approach, you only get the language set in the pages you want.

By the way, I have a problem with the mapping. I’m doing (some kind of “abstract mappings):

<url-mapping id="en">

<pattern value="/#{ /en/ language : userSessionView.language }" />

</url-mapping>

<url-mapping id="es">

<pattern value="/#{ /es/ language : userSessionView.language }" />

</url-mapping>

And then, for example:

<url-mapping id="enViewCMCategory" parentId="en">

<pattern value="/C/#{categoryName}" />

<view-id>/contentmanager/category.jsf</view-id>

<url-mapping id="esViewCMCategory" parentId="es">

<pattern value="/C/#{categoryName}" />

<view-id>/contentmanager/category.jsf</view-id>

</url-mapping>

This will make only the first one be recognized (in this case, /en/C/My+Category+Name)

I guess this is because even though they inherit from different parent mappings, they both have the same mapping (/C/CategoryName)

Is this the expected behaviour?

I have the site working but I can use inheritance only in the first language and “repeat” the wildcard mapping on the other one. i.e.: I have to do, for /es:

<url-mapping id="esViewCMCategory">

<pattern value="/#{ /es/ language : userSessionView.language }/C/#{categoryName}" />

<view-id>/contentmanager/category.jsf</view-id>

</url-mapping>

Regards,

Ignacio