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.

Releases and Announcements

Latest news about the SilverStripe software.

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

2.3 - Default Language Bug ?

Go to End

38 Posts   7307 Views


3 March 2009 at 3:05am Community Member, 787 Posts

To get Silverstripe to produce the correct meta-tags , e.g. :

<meta http-equiv="Content-Language" content="nl"/> instead of <meta http-equiv="Content-Language" content="en"/>

I used to change the default-language by adding the following lines to my _config.php ....


In 2.3. , this does not seem to work anymore ?

All Silverstripe does from that point on is throw "The requested page couldn't be found." at me.. If I erase the lines , everything is okay again.

It did pick up the changed base-language in the CMS itself ......

Can anyone confirm this behaviour ?


3 March 2009 at 11:27am Community Member, 2 Posts

I`m interested in this future too. I tested with 2.3 stable with no luck but it seems to be working with 2.3-rc4 and nightly builds. This bug is mentioned in doc too - [url][/url].


3 March 2009 at 2:36pm Forum Moderator, 801 Posts

Funny coincidence, I've fixed this 3h ago ;) (in trunk for the moment, to be merged into 2.3 via

2.3 was using Translatable::current_lang() for this (= language for the displayed page), meaning if you had translatable disabled you'd always get the default locale. Its now falling back to i18n::get_locale(). Keep in mind that i18n::enable() just enables Translatable in 2.3 (its an alias). Translatable is not supported in the initial 2.3.0 release.

Also, the meta tag is now using the long locale ("en-US" instead of "en") for easier support/conversion to language file paths.

Let me know if you see any problems or side-effects with this approach.


3 March 2009 at 9:28pm Community Member, 787 Posts

Thanks for the quick reply Ingo..

But unfortunately , your patch did not fix my problem....

Still only getting the good old page not found error. Weird....


3 March 2009 at 10:19pm Forum Moderator, 801 Posts

i18n::enable() will actually enable Translatable, meaning multilingual database content.
i18n::set_default_lang() will just route through to Translatable as well, meaning the system is looking for a page in "nl" language. If you've started your site with the default SS locale ("en"), this will cause conflicts. We currently don't have a way to retroactively set the "default language" for existing database content - it will be stored when the record is first created. Does anybody have input on how to implement this both technically and from a UI perspective?

Lars, can you append ?showqueries=1 to your page call, and see what the system is actually trying to find, versus the content stored in your database?


3 March 2009 at 10:46pm (Last edited: 3 March 2009 10:46pm), Community Member, 787 Posts

In previous versions it seemed you could change the base-language at a later stage.

Anyway... If I use :

SELECT `SiteTree_Live`.*, `GhostPage_Live`.*, `ErrorPage_Live`.*, `RedirectorPage_Live`.*, `VirtualPage_Live`.*, `UserDefinedForm_Live`.*, `HomePage_Live`.*, `NewsPage_Live`.*, `SubscribeForm_Live`.*, `SiteTree_Live`.ID, if(`SiteTree_Live`.ClassName,`SiteTree_Live`.ClassName,'SiteTree') AS RecordClassName FROM `SiteTree_Live` LEFT JOIN `GhostPage_Live` ON `GhostPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `ErrorPage_Live` ON `ErrorPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `RedirectorPage_Live` ON `RedirectorPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `VirtualPage_Live` ON `VirtualPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `UserDefinedForm_Live` ON `UserDefinedForm_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `HomePage_Live` ON `HomePage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `NewsPage_Live` ON `NewsPage_Live`.ID = `SiteTree_Live`.ID LEFT JOIN `SubscribeForm_Live` ON `SubscribeForm_Live`.ID = `SiteTree_Live`.ID WHERE (`SiteTree_Live`.URLSegment = 'home') ORDER BY Sort LIMIT 1

This results in a homepage entry, all good.

And For i18n::set_default_lang('nl');

SELECT `SiteTree`.*, `SiteTree_lang`.*, `GhostPage`.*, `ErrorPage`.*, `RedirectorPage`.*, `VirtualPage`.*, `UserDefinedForm`.*, `HomePage`.*, `NewsPage`.*, `SubscribeForm`.*, `SiteTree_lang`.OriginalLangID, if(`SiteTree_lang`.ClassName,`SiteTree_lang`.ClassName,'SiteTree') AS RecordClassName, `SiteTree_lang`.OriginalLangID AS ID FROM `SiteTree_lang` INNER JOIN `SiteTree` ON `SiteTree_lang`.OriginalLangID = `SiteTree`.ID LEFT JOIN `GhostPage` ON `GhostPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `ErrorPage` ON `ErrorPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `RedirectorPage` ON `RedirectorPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `VirtualPage` ON `VirtualPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `UserDefinedForm` ON `UserDefinedForm`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `HomePage` ON `HomePage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `NewsPage` ON `NewsPage`.ID = `SiteTree_lang`.OriginalLangID LEFT JOIN `SubscribeForm` ON `SubscribeForm`.ID = `SiteTree_lang`.OriginalLangID WHERE (HomepageForDomain REGEXP '(,|^) *olct\.dev *(,|$)') AND (`SiteTree_lang`.Lang = 'en') ORDER BY Sort LIMIT 1


SELECT `SiteTree_Live`.*, `SiteTree_lang_Live`.*, `GhostPage_Live`.*, `ErrorPage_Live`.*, `RedirectorPage_Live`.*, `VirtualPage_Live`.*, `UserDefinedForm_Live`.*, `HomePage_Live`.*, `NewsPage_Live`.*, `SubscribeForm_Live`.*, `SiteTree_lang_Live`.OriginalLangID, if(`SiteTree_lang_Live`.ClassName,`SiteTree_lang_Live`.ClassName,'SiteTree') AS RecordClassName, `SiteTree_lang_Live`.OriginalLangID AS ID FROM `SiteTree_lang_Live` INNER JOIN `SiteTree_Live` ON `SiteTree_lang_Live`.OriginalLangID = `SiteTree_Live`.ID LEFT JOIN `GhostPage_Live` ON `GhostPage_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `ErrorPage_Live` ON `ErrorPage_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `RedirectorPage_Live` ON `RedirectorPage_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `VirtualPage_Live` ON `VirtualPage_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `UserDefinedForm_Live` ON `UserDefinedForm_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `HomePage_Live` ON `HomePage_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `NewsPage_Live` ON `NewsPage_Live`.ID = `SiteTree_lang_Live`.OriginalLangID LEFT JOIN `SubscribeForm_Live` ON `SubscribeForm_Live`.ID = `SiteTree_lang_Live`.OriginalLangID WHERE (`SiteTree_lang_Live`.URLSegment = 'home') AND (`SiteTree_lang_Live`.Lang = 'en') ORDER BY Sort LIMIT 1

And Here it starts screwing around with the language vars ....

See attachment for full query-list

Attached Files

12 March 2009 at 8:26am Community Member, 5 Posts

What about a "Fallback Language" ?
This means, if SS can't find a page in the requested language it would fall back to this "backup language".


17 March 2009 at 2:41am Community Member, 787 Posts

This turned out to be quite a problem for me..

I can no longer get silverstripe to run with a different default language...

From the moment I use :

it's all broken...

It works with old sites that have been upgraded to 2.3. , but not for new sites that we build with 2.3 .....

Did anyone find a solution ?

Go to Top