Project

General

Profile

Actions

Bug #78344

closed

Missing use case for overriding language labels with TS and Extbase

Added by Online Now! GmbH about 8 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Target version:
-
Start date:
2016-10-19
Due date:
% Done:

0%

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

Description

I noticed a TypoScript use case not covered by the LocalizationUtility while overriding language labels with TS. It occured with the extension sr_feuser_register, but i think it is more of a extbase problem. In that extension some labels are defined like this:

fe_users.status = Label
fe_users.status.I.0 = Option 1
fe_users.status.I.1 = Option 2

The TypoScriptService Class puts the value of fe_users.status with the key _typoScriptNodeValue in the parsed array. This is not considered in the function LocalizationUtility::flattenTypoScriptLabelArray. The result of this is that the label for fe_users.status is dropped. The lables fe_users.status.I.0 and fe_users.status.I.1 are added though.

This case is also not covered by the unit tests.

I fixed the problem by adding the following to the LocalizationUtility::flattenTypoScriptLabelArray function:

if (is_array($labelValue)) {
    if(isset($labelValue['_typoScriptNodeValue'])) {
        $result[$key] = $labelValue['_typoScriptNodeValue'];
        unset($labelValue['_typoScriptNodeValue']);
    }
    $labelValue = self::flattenTypoScriptLabelArray($labelValue, $key);
    $result = array_merge($result, $labelValue);
} else {
    $result[$key] = $labelValue;
}

A similar code can be found in the TypoScriptService::convertPlainArrayToTypoScriptArray function.

The problem occured in TYPO 7.6.11, but i think it affects all versions up until 8 ( master ).


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #81095: Indexed Search Label "displayResults" not translatable by TypoScriptClosed2017-05-01

Actions
Actions #1

Updated by Online Now! GmbH about 8 years ago

The changed code again:

function LocalizationUtility::flattenTypoScriptLabelArray
...
if (is_array($labelValue)) {
    // lines added begin
    if(isset($labelValue['_typoScriptNodeValue'])) {
        $result[$key] = $labelValue['_typoScriptNodeValue'];
        unset($labelValue['_typoScriptNodeValue']);
    }
    // lines added end
    $labelValue = self::flattenTypoScriptLabelArray($labelValue, $key);
    $result = array_merge($result, $labelValue);
} else {
    $result[$key] = $labelValue;
}
...
Actions #2

Updated by Riccardo De Contardi about 7 years ago

  • Category changed from Extbase to Extbase + l10n
Actions #3

Updated by Riccardo De Contardi about 6 years ago

Hello and sorry for this late reply;

First, I want to thank you very much for your report and your efforts.

Would you consider uploading your patch to Gerrit? Someone could do this for you, but I am thinking you might like the opportunity to contribute to TYPO3 yourself.

You can find a description of the TYPO3 contribution workflow here: https://docs.typo3.org/typo3cms/ContributionWorkflowGuide/

Hint: If you get stuck anywhere, ask on Slack in the #typo3-cms-coredev channel. You can register in the TYPO3 slack workspace here: https://forger.typo3.com/slack

Thank you in advance and best regards!

Actions #4

Updated by Georg Ringer over 4 years ago

  • Status changed from New to Closed

closed as duplicate of #81095

Actions #5

Updated by Georg Ringer over 4 years ago

  • Related to Bug #81095: Indexed Search Label "displayResults" not translatable by TypoScript added
Actions

Also available in: Atom PDF