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.

Archive

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

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

Multilanguage Website


Reply

3 Posts   2824 Views

Avatar
carnal

6 July 2007 at 1:30am Community Member, 19 Posts

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

6 July 2007 at 5:31am Community Member, 19 Posts

Nobody who builds a multilanguage site?!

Regards

Hartmut

Avatar
Sam

8 July 2007 at 9:13pm Administrator, 685 Posts

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!