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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Translating only certain pages

Go to End



Community Member, 12 Posts

23 August 2011 at 9:57am

Hi there,

I need some advice please.

I am building a website which will be aimed at customers in NZ, UK, and AUS. The default language is NZ, and this is set in _config.php

95% of the website will be exactly the same for all visitors, however for each country there will be one or two pages which are either not relevant (so should not display in menus) or will have slightly different content.

I had started using the Translatable extension, but it seems like this is really only suitable if you want to have different versions of the whole site, whereas in my case it is only a couple of pages that will be different. It seems silly to set up many versions of all pages with different URLs as it would only be a few pages that would be different from country-to-country.

So here is my current thinking:

  • I will create new HTMLEditorFields in the CMS called "UK Content", "Australian Content" etc.
  • I detect the visitor's country with this method:
  • In my page template(s), I do a check: if the visitor's country is UK or AUS, and there is content in the relevant CMS field, show e.g. $UKContent. Otherwise show $Content.
  • Create CMS checkboxes "Don't show in NZ", "Don't show in UK" etc. Add this condition to nav menu loops so that only pages available in that country show.

Is this a good/bad idea? Any advice greatly appreciated, as I have not found any examples out there of others doing this. I'm not great with PHP so any sample code would be helpful too! :D