Issue Bug Closed

#104468Allow non-english languages as FE default language

Hannes Lau 07/24/24, 11:17 updated 10/15/24, 09:08

Description

We have a lot of projects where the sites are created in German and later translated to English. This is true for the site content but also for the xlf labels. So our source locallang.xlf files are in German. Translation agencies create the translation files, such as en.locallang.xlf or zh.locallang.xlf. It is way easier for them to work forward from the locallang.xlf with the source tags, then backwards (target -> source) from a translated de.locallang.xlf.

Up to TYPO3 12, this worked fine. We just had to register English as another translation language in ext_localconf.php.

// As this site uses German as the default language, register English as a translation language
$GLOBALS['TYPO3_CONF_VARS']['SYS']['localization']['locales']['user'] = ['en' => 'English'];

Since TYPO3 12, probably since https://review.typo3.org/c/Packages/TYPO3.CMS/+/77558 this does not work any more.

https://github.com/TYPO3/typo3/blob/main/typo3/sysext/core/Classes/Localization/LanguageService.php#L296 has been altered:

    private function getTypo3LanguageKey(): string
    {
        if ($this->locale === null) {
            return 'default';
        }
        if ($this->locale->getName() === 'en') {
            return 'default';
        }
        return $this->locale->getName();
    }

This forces our language ‘en’ back to ‘default’. But default is German. When we remove those lines, it seems to work fine. Do we need them in the core?

Reviews 2