Jump to:

649 Posts in 1606 Topics by 162 members

Releases and Announcements

SilverStripe Forums » Releases and Announcements » 2.3 - Default Language Bug ?

Latest news about the SilverStripe software.

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

Page: 1 2 3 4 5
Go to End
Author Topic: 6829 Views
  • Fuzz10
    Avatar
    Community Member
    786 Posts

    2.3 - Default Language Bug ? Link to this post

    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 ....

    i18n::enable();
    i18n::set_locale('nl_NL');
    i18n::set_default_lang('nl');

    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 ?

  • BIBO
    Avatar
    Community Member
    2 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

    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 - http://doc.silverstripe.com/doku.php?id=multilingualcontent.

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

    Funny coincidence, I've fixed this 3h ago ;) http://open.silverstripe.com/changeset/72367 (in trunk for the moment, to be merged into 2.3 via http://open.silverstripe.com/ticket/3517)

    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.

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

    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....

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

    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?

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

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

    Anyway... If I use :
    i18n::set_default_lang('en');

    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

    and

    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
  • Gargo
    Avatar
    Community Member
    5 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

    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".

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: 2.3 - Default Language Bug ? Link to this post

    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 :
    i18n::set_default_lang('xx');

    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 ?

    6829 Views
Page: 1 2 3 4 5
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.