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.

General Questions

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

Language Selector


7 Posts   689 Views


14 October 2011 at 10:11am Community Member, 13 Posts

I would like to create a simple drop down menu on each page that allows the user to translate the page into their preferred langauge. I have looked over many of the forum post about translating pages and not found what it is that I am looking for.

I would simply like a drop down field on each page with the available languages that the page could be translated into. I have looked over the i18n file, changed a few lines in _config.php but only got the result of page translation in the admin section.

I am sure that there is a simple solution/answer to this, but I just can not figure it out. could some one please assist me?


14 October 2011 at 7:47pm Community Member, 135 Posts

You need something along these lines:


15 October 2011 at 2:56am Community Member, 13 Posts

Yeah, I already read over that, attempted to activate it as well. Is there a way to make the langauge selector a drop down list other than a set of flags for the user to click on?


15 October 2011 at 4:02am Community Member, 135 Posts

You can output the language switcher any way you want in the template, as list (which you make to look like some sort of dropdown menu). Or if you want a real form, build it in the controller and render that in the template.

Then you can build JavaScript on top of that if you want the switching to be done that way. Really, you can make it look and behave any way you want.


15 October 2011 at 5:49am Community Member, 13 Posts

Alright, I have gotten the drop down to show up in the admin section. Lets say I choose spanish as what I want the page translated too. I select spanish from the translations tab. I go back to my content tab, where it shows Navigation label, and underneath Orginial Navigation label, content, and oririginal content. They are the same, both still in english.

Have I missed a step to have the page translated, or does it not auto translate? Also, when on the front end and I click the flag for spanish, all of the menu choices except the page I am on disapear, along with the side bar.

I really feel I have missed a step.

I do apreciate your help, and quick answers by the way.


15 October 2011 at 6:50am Forum Moderator, 1095 Posts

The Translatable module lets you create 'translations' in the cms for, say, Spanish, but in fact they are just duplicates of pages in the original language. When creating these translations, you are in a way creating a 'second website' for the new language.

So when you go visit a Spanish page on the website itself, you end up in the Spanish part of your website, where in the nav menu's you will only see the other spanish pages.

In the backend you need to make sure to create translations for every page you want to appear in the spanish site. And unfortunately, translations are just new pages on the Spanish site. The contents are not automatically translated to Spanish - this you need to do yourself... :-(


15 October 2011 at 6:56am Community Member, 13 Posts

Yup, I figured it out up to that point. I guess I need to learn spanish :)

Thanks again for all of your help.