Project

General

Profile

Actions

Bug #87056

closed

Default language not respecting.

Added by Ricky Mathew almost 6 years ago. Updated over 5 years ago.

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 #1

Updated by Benni Mack over 5 years ago

  • Status changed from New to Needs Feedback

Hey,

the solution would be actually to move the Swiss language inside the Yaml file to the first position. Does that work for you?

IMHO "Default Language" should be independent of the URL.

Actions #2

Updated by Ricky Mathew over 5 years ago

Benni Mack wrote:

Hey,

the solution would be actually to move the Swiss language inside the Yaml file to the first position. Does that work for you?

IMHO "Default Language" should be independent of the URL.

i thought the default language is something with base set to '/'.For that notion my solution works as expected.I also think, to move the language with base set to '/' onto the first position will be the better solution.

Actions #3

Updated by Benni Mack over 5 years ago

Hi Ricky,

i thought the default language is something with base set to '/'.For that notion my solution works as expected.I also think, to move the language with base set to '/' onto the first position will be the better solution.

well, there are scenarios for language setups like:

language=0 https://example.com/
language=1 https://example.de/
language=2 https://example.de/en/
language=2 https://example.de/fr/

where the default language can only be guessed...

Actions #4

Updated by Benni Mack over 5 years ago

  • Target version changed from next-patchlevel to Candidate for patchlevel
Actions #5

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from Needs Feedback to Closed
  • Assignee deleted (Ricky Mathew)

No feedback since the last 90 days => closing this issue.

If you think that this is the wrong decision or experience the issue again and have more information about how to reproduce your problem, please reopen it or ping me.

Thank you and best regards

Actions #6

Updated by Riccardo De Contardi over 5 years ago

  • Target version deleted (Candidate for patchlevel)
Actions

Also available in: Atom PDF