Revert "[TASK] Change if conditions in LocalizationUtility" 74/39374/4
authorFrank Nägler <typo3@naegler.net>
Fri, 8 May 2015 22:25:21 +0000 (00:25 +0200)
committerFrank Nägler <typo3@naegler.net>
Fri, 8 May 2015 22:34:31 +0000 (00:34 +0200)
This reverts commit 217954659043ff6ed48a2d5f2e1f6c3207cb9b21.

LocalizationUtility patch breaks labels, see screenshots in
forge issue #66864

Resolves: #66864
Reverts: #63026
Releases: master

Change-Id: I5e5d2209767ef53909fccf0bef2f6fae5d3edafb
Reviewed-on: http://review.typo3.org/39374
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php

index ce812d5..6b3fbd3 100644 (file)
@@ -79,9 +79,11 @@ class LocalizationUtility {
         * @api
         * @todo : If vsprintf gets a malformed string, it returns FALSE! Should we throw an exception there?
         */
-       static public function translate($key, $extensionName = '', $arguments = NULL) {
+       static public function translate($key, $extensionName, $arguments = NULL) {
                $value = NULL;
-               if (!empty($key) && !empty($extensionName)) {
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($key, 'LLL:')) {
+                       $value = self::translateFileReference($key);
+               } else {
                        self::initializeLocalization($extensionName);
                        // The "from" charset of csConv() is only set for strings from TypoScript via _LOCAL_LANG
                        if (!empty(self::$LOCAL_LANG[$extensionName][self::$languageKey][$key][0]['target'])
@@ -107,18 +109,13 @@ class LocalizationUtility {
                                        }
                                }
                        }
-                       if (
-                               $value === NULL && (!empty(self::$LOCAL_LANG[$extensionName]['default'][$key][0]['target'])
+                       if ($value === NULL && (!empty(self::$LOCAL_LANG[$extensionName]['default'][$key][0]['target'])
                                || isset(self::$LOCAL_LANG_UNSET[$extensionName]['default'][$key]))
                        ) {
                                // Default language translation for key exists
                                // No charset conversion because default is English and thereby ASCII
                                $value = self::$LOCAL_LANG[$extensionName]['default'][$key][0]['target'];
                        }
-               } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($key, 'LLL:')) {
-                       $value = self::translateFileReference($key);
-               } else {
-                       return NULL;
                }
                if (is_array($arguments) && $value !== NULL) {
                        return vsprintf($value, $arguments);