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.

Template Questions /

404 for multilanugage problem


Reply


3 Posts   1251 Views

Avatar
snaip

Community Member, 180 Posts

20 January 2010 at 2:17am

hello

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 ?

Avatar
Juanitou

Community Member, 323 Posts

20 January 2010 at 10:10am

Hi!

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

Regards,
Juan

Avatar
Ingo

Forum Moderator, 801 Posts

25 January 2010 at 1:14pm

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()