Project

General

Profile

Bug #93240

Updated by Torben Hansen almost 4 years ago

When you have a TYPO3 website that handles exactly one domain for different languages, it is either possible to use a single tree which includes all languages or it is possible to configure one tree for each language (e.g. if the structure of the translated site strongly differs from the default language). Currently the last setup is not intuitively possible to archive, since there seems to be a bug in the SiteMatcher. 

 *Scenario:* 

 The domain http://master.typo3.local/ should be available in 4 languages.  

 * German and english follow a strict translation (site1) 
 * Danish only has a small subset of pages of the "main" site (site2) 
 * French has a different page template and thus a different menu structure (site3) 

 3 sites are configured as shown on the following screenshot. 

 !sites.png! 

 All 3 sites have http://master.typo3.local/ as entry point (base) and the appropriate language configuration with a base for each language. 

 *Current behavior:* 

 When opening http://master.typo3.local/, the website is shown in french (redirected to http://master.typo3.local/fr/). french. Expected is the german version of the website. 

 *Problem location:* 

 The SiteMatcher component uses the function getRouteCollectionForAllSites() to return a RouteCollection with possible sites for the current route. This function also uses the "main" entry point (without a language configuration) to resolve the route, so actually multiple matches for the "/" route will be determined. As seen on the screenshot below, actually all 3 sites will be considered to resolve the "/" route for the domain as shown on the debug output below. 

 !routes.png! 

 Obviously, the last one "wins" when the Symfony UrlMatcher matches the rroute. 

 *Possible solution:* 

 getRouteCollectionForAllSites() should only add Sites the the RouteCollection, that also have a language. If I remove line 196 (https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/core/Classes/Routing/SiteMatcher.php#L196), everything works fine. Since a Site Object always seem to have at least a language, it is not really clear to my, why getRouteCollectionForAllSites() also tries to match routes for sites with no language. 

 *Why not move the language to the entry point base?* 

 It is possible to work around this problem by moving the language specific base to the entry point base. This will however be a problem, if e.g. the french site becomes a "subsite" having multiple languages, where the subsite URL segment also must be translated. 

 +Example:+ 

 * http://master.typo3.local/translated-fr-subsite-title/fr/ 
 * http://master.typo3.local/translated-it-subsite-title/it/ 

 As shown in the example, it will not be possible to translate the subsite title, when it is part of the entry point base.

Back