[BUGFIX] Localization of a constant string is empty
authorXavier Perseguers <typo3@perseguers.ch>
Fri, 15 Jul 2011 07:27:03 +0000 (09:27 +0200)
committerXavier Perseguers <typo3@perseguers.ch>
Fri, 15 Jul 2011 09:38:43 +0000 (11:38 +0200)
When using a constant string (e.g., "CSS Styled Content") instead of a
localization key (e.g., "LLL:EXT:some_ext/locallang.xml:key"), the constant
string should be returned instead of an empty string.

Change-Id: I409664dc5174d818e875fd03a7e6c6e7fbda9e91
Fixes: #28223
Reviewed-on: http://review.typo3.org/3345
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Dominique Feyer
Tested-by: Dominique Feyer
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
typo3/sysext/lang/lang.php

index 4d76e4e..36f196e 100755 (executable)
@@ -345,7 +345,7 @@ class language {
         */
        public function sL($input, $hsc = FALSE) {
                        // If cached label
-               if (!isset($this->LL_labels_cache[$this->lang][$input])) {
+               if (!isset($this->LL_labels_cache[$this->lang][$input]) && substr($input, 0, 4) === 'LLL:') {
                        $restStr = trim(substr($input, 4));
                        $extPrfx = '';
 
@@ -373,7 +373,13 @@ class language {
                }
                        // For the cached output charset conversion has already happened!
                        // So perform HSC right here.
-               $output = $this->LL_labels_cache[$this->lang][$input];
+               if (isset($this->LL_labels_cache[$this->lang][$input])) {
+                       $output = $this->LL_labels_cache[$this->lang][$input];
+               } else {
+                               // Use a constant non-localizable label
+                       $output = $input;
+               }
+
                if ($hsc) {
                        $output = t3lib_div::deHSCentities(htmlspecialchars($output));
                }