Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Multilanguage Website

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2783 Views
  • carnal
    Avatar
    Community Member
    19 Posts

    Multilanguage Website Link to this post

    Hi there,

    could someone give me an idea about realizing a multilanguage website with SilverStripe?! To be clear here: Frontend Content - not Admin.

    I know that this point is in progress and development, but i need now a solution to this. Anyone?!

    Thanks.

    Hartmut

  • carnal
    Avatar
    Community Member
    19 Posts

    Re: Multilanguage Website Link to this post

    Nobody who builds a multilanguage site?!

    Regards

    Hartmut

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Multilanguage Website Link to this post

    Your best bet is to add a custom fields in your Page class, such as GermanTitle and GermanContent

    Then make 2 functions, Title() and Content(), on your Page class:

    function Title() {
    if( /* current language is german */) {
    return $this->GermanTitle;
    } else {
    return $this->Title;
    }
    }

    The final thing you've got to choose is how to switch between German and English. The simplest is probably a session variable, although this isn't very Google-friendly.

    An alternative would be to set up a Director rule (call to Director::addRules) that mapped de/$URLSegment/$Action to a German version of ModelAsController.

    I haven't spelled it out completely, but this should get you started. Good luck!

    2783 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.