Jump to:

23379 Posts in 18298 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Setting locale via URL

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 631 Views
  • smares
    Avatar
    Community Member
    25 Posts

    Setting locale via URL Link to this post

    Hey guys,

    I am trying to figure out a way to make SilverStripe write the locale in the URL and also set the locale based on the URL. The idea is to have links such as www.mysite.com/en_US/home or www.mysite.com/de_DE/home. I am wondering what the best approach would be for this. The first problem is redirecting to the right locale based on the URL. I could either use a director rule and write a custom controller that extends ModelAsController or I could simply add a DataObjectDecorator to SiteTree and use Director redirects for that. What other options do I have?
    The next step would be rewriting the links SilverStripe generates to include the locale. I also need to teach the static file publisher to create folders based on the locale and dump the files in there. Finally, I would need to tell SilverStripe to allow pages with the same name if they're in different languages. Is this even possible without core modifications?
    The stuff I found so far deals with SilverStripe 2.2 or 2.3 and no longer works well with 2.4. I also use Translatable and having per-language nodes in the site tree isn't an option.

    Cheers

    631 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.