Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Multilanguage Website


Go to End


3 Posts   3204 Views

Avatar
carnal

Community Member, 19 Posts

6 July 2007 at 1:30am

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

Avatar
carnal

Community Member, 19 Posts

6 July 2007 at 5:31am

Nobody who builds a multilanguage site?!

Regards

Hartmut

Avatar
Sam

Administrator, 690 Posts

8 July 2007 at 9:13pm

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!