Actions
Bug #87056
closedDefault language not respecting.
Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2018-12-03
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
routing,preview
Complexity:
easy
Is Regression:
Sprint Focus:
Description
I have a site configuration as follows for a multilanguage site:
rootPageId: 211
base: 'https://example.com/'
baseVariants: { }
languages:
-
title: Default
enabled: false
languageId: '0'
base: /en/
typo3Language: default
locale: en_US.UTF-8
iso-639-1: en
navigationTitle: English
hreflang: en-US
direction: ''
flag: global
-
title: 'Swiss German'
enabled: true
languageId: '6'
base: /
typo3Language: de
locale: de_CH
iso-639-1: de
navigationTitle: Deutch
hreflang: de-CH
direction: ''
fallbackType: strict
flag: ch
-
title: 'Swiss French'
enabled: true
languageId: '10'
base: /fr_CH/
typo3Language: fr
locale: fr_CH.UTF-8
iso-639-1: fr
navigationTitle: Francais
hreflang: fr-CH
direction: ''
fallbackType: strict
flag: ch
errorHandling: { }
routes: { }
I use Swiss German as default language which is the second language in my page structue with base '/'(.i.e inbuilt default language is not using in fronend).
As a result, on clicking page preview of pagetree from backend it generates url like 'https://example.com/en/examplepage' which is not i wanted.
I want the pagetree to generate page preview for swiss german language (like 'https://example.com/beispiel') by default.
So i have the following work around in 'TYPO3\CMS\Core\Site\Entity\Site' class on picking default language:
/**
* @inheritdoc
*/
public function getDefaultLanguage(): SiteLanguage
{
+ foreach ($this->languages as $language) {
+ if($language->getBase()->getPath()=='/'){
+ return $language;
+ }
+}
return reset($this->languages);
}
I
If you guys have no objection i can push it to the core.What are your thoughts?
Actions