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

#20698

domdorn
Participant

to also add something to this topic:

I’ve solved this some time ago with a set of files.

I just put them into this gist:

https://gist.github.com/a805f5c4be59c70ab9b3

What I would suggest:

do your mappings like

<url-mapping id=”home”>

<pattern value=”/#{language}/somepage/#{someBean.value}/vblabla” />

<view-id>/someview.jsf</view-id>

</url-mapping>

and then adjust the LangFilter (which is called after the pretty filter) to read out the param “language” from the request object and set the locale accordingly. In the example code, I did it using cookies, but its quite easy to do with request params.

Your locale is now correctly set on the HttpServletRequest and in JSF, so you can facilitate the JSF built-in ways of doing i18n etc.

hth,

dominik