Jump to:

3448 Posts in 1032 Topics by 873 members

Template Questions

SilverStripe Forums » Template Questions » 404 for multilanugage problem

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

Page: 1
Go to End
Author Topic: 1247 Views
  • snaip
    Community Member
    180 Posts

    404 for multilanugage problem Link to this post


    i have 3 languages site EN,PL and DE
    and in CMS 404 error page for each language

    here are the names of this pages:

    EN - page-not-found
    PL - nie-znaleziono-strony
    DE - seite-nicht-gefunden

    but i always get EN 404 error page, no matter if i am on english,polish or german version

    also in source of error_page i have

                <% if Locale == "en_US" %>
                   <% include ikony_en %>
                <% end_if %>

                <% if Locale == "de_DE" %>
                   <% include ikony_de %>
                <% end_if %>

                <% if Locale == "pl_PL" %>
                   <% include ikony_pl %>
                <% end_if %>

    but it doesnt work too

    what is the reason ?

  • Juanitou
    Community Member
    323 Posts

    Re: 404 for multilanugage problem Link to this post


    I think that’s an old bug with 2.3 series, but I’ve not found it on Trac. Maybe you could submit one.


  • Ingo
    Forum Moderator
    801 Posts

    Re: 404 for multilanugage problem Link to this post

    The problem is that we don't have enough information in the URL to determine which language to show the 404 page in.
    As of 2.4 alpha1, this works:

    http://mysite/unknown-page // shows in english (assuming its the default locale)
    http://mysite/unknown-page?locale=de_DE // shows in german

    Of course, you can't rely on visitors setting the right locale when accessing pages.
    There's no built-in way support for getting a locale from different TLDs (mysite.de, mysite.com, etc),
    or from pseudo sub-urls (mysite.com/de/unknown-page), which would provide this information.
    This is a known limitation, see http://open.silverstripe.org/ticket/3877

    Another approach would be to inspect the "Accept" language in HTTP headers in Page_Controller->init()
    and redirect appropriately.

    If anybody wants to attempt a core patch for this, submissions are welcome
    Pointers: ModelAsController->getNestedController(), Translatable->contentcontrollerInit(), ErrorPage::response_for()

Page: 1
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.