Issue Bug Resolved

#103658LanguageMenuProcessor / (Routing) creates invalid links if a record is not translated

Yannis Viol 04/18/24, 07:45 updated 11/06/26, 06:00

Description

The TYPO3-Core routing has problems with non existing record translations.

I have a site where all languages are configured with fallbackType: strict.

*PersistedAliasMapper*
If I want to generate a language menu with the LanguageMenuProcessor it generates links for records that are not translated and therefore lead to a 404 e.g. (/fr/about-us/media-news/actualites/detail/3669/).
If a translation exists the route is mapped correctly and replaces the uid in the url with the slug value.

*Default*
It just links to the default uri e.g. (/fr/about-us/media-news/actualites/detail/) also leading to a 404 (which is correct in theory)

So I debugged the Core until I found the Code where it struggles to handle the correct uri’s.

*MappableProcessor.php::66 (called in PageRouter.php::349)*
If a RouteEnhancer is passed here and has a empty value the generate method should throw a exception because otherwise it will generate a false uri in the PageRouter.php.
If this change is made it starts to render default uri’s for the plugin e.g.(tx_package_plugin…) hence we need some more changes because this still leads to a 404.

*PageRouter::329*
If at least one route is matching (RouteSorter -> PageRouter.php::329) it shouldn’t add the default router to the $allRoutes array. So I added this snippet for testing purposes:

if (count($allRoutes) > 1 && $allRoutes['default']) {
   unset($allRoutes['default']);
}

These changes fix it 99% somehow now in the language menu object the entries are marked as available but with an empty link so at the moment I have to check in the fluid like this:

<f:if condition="{language.available} && {language.link}">

It seems that this Bug is existing for quite a while already because i found several extensions that implemented classes to render a language menu on the detail view:
DisableLanguageMenuProcessor.php at main derhansen/sf_event_mgt
DisableLanguageMenuProcessor.php at main georgringer/news

Best Regards
Yannis

Reviews 2

Files 1

History 520

  1. Georg Ringer commented and changed status Under Review Resolved <span data-processor="relativetime" data-value="2026-11-06T06:00:16+00:00" > 11/06/26, 06:00 </span>

    Applied in changeset commit:e3c7c09ea6bfefd559692996150c4d3e6d07142e.