Issue Bug Closed

#86194Translation fails if file locallang.xlf is not provided

Georg Tiefenbrunn 09/07/18, 21:01 updated 10/02/18, 10:25

Description

Prior to #82354 it was possible to define all language labels in plain TypoScript using plugin.tx_extkey._LOCAL_LANG without the need to define LLL in an XLIFF file.

As LocalizationUtility.php::loadTypoScriptLabels() now checks isset(self::$LOCAL_LANG[$languageFilePath][$languageKey]) translation using <f:translate /> and LocalizationUtility::translate() fails if the extension does not provide a locallang.xlf file.

Steps to reproduce:

Create an extension without a extkey/Resources/Private/Language/locallang.xlf file and define some LLL:

plugin.tx_extkey._LOCAL_LANG.default {
  test1 = Test 1
}

<f:translate key="test1" extensionName="extkey" default="###Default value for test1###" /> will output ‘###Default value for test1###’.

Workaround:

Create a extkey/Resources/Private/Language/locallang.xlf file and add at least one dummy entry (e.g. <trans-unit id="extKey"><source>extKey</source></trans-unit>). Now <f:translate key="test1" extensionName="extkey" default="#Test 1" /> will output ‘Test 1’

Reviews 1