Best practice for i18n url patterns?!?

Splash Forums PrettyFaces Users Best practice for i18n url patterns?!?

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Lincoln Baxter III 6 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #17969

    Hello,

    I’m currently struggeling how to solve my url rewriting with i18n. Lets say I have a multilingual application and I want to have the for each language nicely url mappings in user language.

    For example the forum mapping should be forums.html for english locale and forum.html for german locale. Now my problem is that I cant use 2 url mappings since my navigation based on the id like pretty:myId which point allways to one mapping.

    You think it is maybe possible if I going switch from annotation mapping and build up the pretty configuration on runtime, like observing server start check out the given languages and build the url mapping from message properties like myId-en and myId-de and add to configuration. Then I could use an helper class to resolve the real id like pretty:myId-#{localeBean.locale}. I dont really like that idea.

    Any solutions about that point?

    Thanks,

    Sebastian

    #21081

    Hey Sebastian,

    This is actually something we’d really like to support. Unfortunately we don’t really have any good method to do this :( I think the best way to go is probably to add a locale parameter to the <url-mapping locales="DE,VE"/>, which would detect the current locale from various underlying frameworks via a service interface (see below) but coming up with a strategy for this would definitely be good.

    We could create something like this for use within prettyfaces to help resolve teh locale:

    public interface com.ocpsoft.pretty.faces.spi.LocaleResolver
    {
    public Locale getLocale();
    }

    So for JSF for instance, the resolver would need to ask JSF what the current locale is set to. These resolvers would be iterated over until a locale is found. If no resolver returns a locale, default to the current system locale.

    Want to put together a prototype for this and see what happens??

    ~Lincoln

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.