Project

General

Profile

Actions

Bug #66872

closed

Only output of default xml-labels in TYPO3 6.2.12

Added by Susanne Weierstall over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-05-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

After update from Version 4.5.40 to 6.2.12 the substitiution of xml-labels does not work properly.

The problem occured after updating a website with multiple languages. In most languages everything works correctly, 3 languages cause problems.

In this 3 languages every output of xml is the default-labels instead of the labels defined for the certain language.This happens for Extensions like Formhandler or Freecap and for Typoscript like:
5 = TEXT
5.data = LLL:fileadmin/sprachdateien/allgemein.xml:aktuelles

Something like "lang.en = my Title" works.

All languages are defined the same way, for example:[globalVar = GP:L = 1]
config {
language = en
locale_all = en_GB
sys_language_uid = 1
htmlTag_setParams = lang="en"
}
[END]

RealUrl is installed. I tried to disable, but the problems persist.

Before update everything worked fine.


Files

mytest.xml (407 Bytes) mytest.xml Example of an xml-file Susanne Weierstall, 2015-05-10 13:27

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #53973: Cannot add user defined locales to be used with "sL(...)"Closed2013-11-26

Actions
Actions #1

Updated by Stephan Großberndt over 9 years ago

Verified using this setup:

config {
  linkVars = L
  language = de
  sys_language_uid = 0
  htmlTag_setParams = lang="de" 
}

[globalVar = GP:L=1]
config {
  language = en
  sys_language_uid = 1
  htmlTag_setParams = lang="en" 
}
[global]

page = PAGE
page.10 = TEXT
page.10.value = Hello World!

page.20 = TEXT
page.20.data = LLL:fileadmin/mytest.xml:test

with a website language english [sys_language_uid = 1] defined on root.

Calling "/index.php?id=1&L=1&no_cache=1" on TYPO3 4.5 results in "Hello World!English (UK)", on TYPO3 6.2: "Hello World!Deutsch"

The TYPO3 6.2 version contains "<html lang="en">", so the language handling is taken into account in general.

Actions #2

Updated by Ephraim Härer over 9 years ago

Did you try to use an xlf-file instead of an xml-file?

Actions #3

Updated by Stephan Großberndt over 9 years ago

In TYPO3 4.5 this code is used: typo3\sysext\cms\tslib\class.tslib_fe.php

    function readLLfile($fileRef)    {
        return t3lib_div::readLLfile($fileRef, $this->lang, $this->renderCharset);
    }


Here $this->lang is passed as a parameter ("en" in our case) and all is well.

In TYPO3 6.2 this code is used: typo3\sysext\frontend\Classes\Controller\TypoScriptFrontendController.php

    /**
     * Read locallang files - for frontend applications
     *
     * @param string $fileRef Reference to a relative filename to include.
     * @return array Returns the $LOCAL_LANG array found in the file. If no array found, returns empty array.
     * @todo Define visibility
     */
    public function readLLfile($fileRef) {
        if ($this->lang !== 'default') {
            $languages = array_reverse($this->languageDependencies);
            // At least we need to have English
            if (empty($languages)) {
                $languages[] = 'default';
            }
        } else {
            $languages = array('default');
        }

        $localLanguage = array();
        foreach ($languages as $language) {
            $tempLL = GeneralUtility::readLLfile($fileRef, $language, $this->renderCharset);
            $localLanguage['default'] = $tempLL['default'];
            if (!isset($localLanguage[$this->lang])) {
                $localLanguage[$this->lang] = $localLanguage['default'];
            }
            if ($this->lang !== 'default' && isset($tempLL[$language])) {
                // Merge current language labels onto labels from previous language
                // This way we have a label with fall back applied
                \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($localLanguage[$this->lang], $tempLL[$language], TRUE, FALSE);
            }
        }

        return $localLanguage;
    }

$this->languageDependencies is initialized by calling initLLvars().

        // Finding the requested language in this list based
        // on the $lang key being inputted to this function.
        /** @var $locales \TYPO3\CMS\Core\Localization\Locales */
        $locales = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Locales');
        $locales->initialize();

        // Language is found. Configure it:
        if (in_array($this->lang, $locales->getLocales())) {
            $this->languageDependencies[] = $this->lang;
            foreach ($locales->getLocaleDependencies($this->lang) as $language) {
                $this->languageDependencies[] = $language;
            }
        }

Here is the reason: Only if $this->lang is found to be a valid entry in $locales->getLocales() it is used.

This means: On TYPO3 6.2 you can ONLY use keys in locallang files which have been defined in typo3\sysext\core\Classes\Localization\Locales.php:$languages

Actions #4

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39512

Actions #5

Updated by Xavier Perseguers over 9 years ago

  • Status changed from Under Review to Closed

closed as won't fix since patch has been abandoned.

Actions

Also available in: Atom PDF