-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
404 Page Not Found missing correct localization on multilingual sites #6500
Comments
Currently, pages that are not associated to a language (for example: login, page not found, forbidden, ...) use the last known language. |
I reckon it would make sense to have this order of priority for the page_not_found language:
|
@mlocati That does indeed work for the login page, locale is set to |
@jlucki This is strictly related to #6447 (and I don't know why @aembler closed that issue). Indeed, this SQL query select
PagePaths.cPath,
Pages.siteTreeID
from
PagePaths
inner join Pages on PagePaths.cID = Pages.cID
where
PagePaths.cPath in ('/login', '/page_not_found') results in
That means that there's no language associated to the Login page (so, concrete5 will use the last one, falling back to the default one). I can't solve this issue with the current database structure. As I wrote in #6447, I think we'd need a new column in the Pages table (to associate a page to a site, but not to a specific language in that site). |
@mlocati @aembler Is there a reason page_not_found is associated with siteTreeID 1? I've disassociated this on my local (changed it to 0), and the 404 page now behaves as expected. http://localhost:8888/index.php/fr/404 results in: It's even removed the related pages buttons which really have no reason to be visible on a 404 page. |
https://github.com/concrete5/concrete5/compare/develop...jlucki:fix-6500?expand=1 The above fixes my 404s issues. I've made page_not_found match page_forbidden settings. Does that look ok? I can open a PR if so. |
I believe this is a bug – with the idea that we might want to have a page not found page that honors different themes in a multi-site approach. But obviously this doesn't really work when we keep it in a single site tree. I think your approach is probably the right one. I'm going to assign this to the 8.4.0 milestone and we will get this updated in there. |
404 pages have a few issues on multilingual sites, some seem like bugs, others might fall under the purview of enhancements/nice to haves, but I'll post them all here anyway since they all kinda fall under the same umbrella.
I've set this up on the the development branch but these have been present since at least 8.2.1.
Steps to reproduce:
Note: I've included my local urls, but change those where appropriate.
Install concrete5, I've set it up with the empty theme but this doesn't matter.
Navigate to http://localhost:8888/index.php/dashboard/system/multilingual/setup
Add locale
Details: I added French, template Full, page name Home, slug fr
3a) I've also enabled toolbar titles for a bit more clarity
Add
<?php echo \Concrete\Core\Localization\Localization::activeLocale(); ?>
toconcrete/themes/elemental/page_not_found.php
Navigate to http://localhost:8888/index.php/404
This results in a standard 404 page, with en_US shown on the page as the locale, so this expected behaviour
Now try it with the french locale slug http://localhost:8888/index.php/fr/404
This is where things get confusing. This still loads the standard 404 page, but the localization is lost, we are still seeing en_US as the locale, even though we're on the french localization of the site
Additionally, concrete5 seems to not know what language to display here, as we're seeing two related pages language buttons in the toolbar
Now, go back to http://localhost:8888/index.php/dashboard/system/multilingual/setup and change the default locale to French
Go back to http://localhost:8888/index.php/fr/404
I would expect the locale to now show as fr_FR, but it still shows as en_US
This all makes localization of 404 pages very difficult.
Halfway solution:
This isn't really a solution, but it worked for my use case. Hopefully it at least points to a resolution.
http://localhost:8888/index.php/dashboard/system/multilingual/setup change the default locale back to english
The issues are all, as far as I can tell, in: https://github.com/concrete5/concrete5/blob/develop/concrete/src/Http/ResponseFactory.php
Line 92, I've replaced
$item = '/page_not_found';
with
and line 237, I've replaced
if ($collection->getCollectionPath() != '/page_not_found') {
with
if (strpos($collection->getCollectionPath(), '/page_not_found') == false) {
I also had to copy the
Page Not Found
system page across to all locales using the sitemap in the dashboard.Now visit http://localhost:8888/index.php/fr/404
This leads to something slightly more in line with expected behaviour. This doesn't fix the duplicate related pages buttons, but they both appear as the correct language now, and the localization locale appears correct now too.
It seems to me that the locale isn't actually ever set on system pages, regardless of the settings. System pages will just always be whatever language the site was installed with.
The text was updated successfully, but these errors were encountered: