[BUGFIX] Allow empty values for js language labels 41/46241/2
authorThomas Schlumberger <thomas@b13.de>
Tue, 26 Jan 2016 11:52:07 +0000 (12:52 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 26 Jan 2016 12:49:12 +0000 (13:49 +0100)
When a user has a translated backend where not all
labels are translated, Lang.js throws an js exception
for accessing empty values.

The check for empty values therefor must be hardened.

Resolves: #72806
Releases: master, 7.6
Change-Id: I2801076945f6a291fb3b05c0438f18c0d737e8de
Reviewed-on: https://review.typo3.org/46241
Reviewed-by: Daniel Gorges <daniel.gorges@b13.de>
Tested-by: Daniel Gorges <daniel.gorges@b13.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/lang/Resources/Public/JavaScript/Lang.js

index 82e916d..8651ae4 100644 (file)
@@ -32,7 +32,11 @@ define(['jquery'], function($) {
                var originalLangObject = $.extend(true, {}, TYPO3.lang);
                TYPO3.lang = [];
                $.each(originalLangObject, function(index, value) {
-                       TYPO3.lang[index] = value[0].target || value[0].source || value;
+                       if (typeof value !== "undefined" && typeof value[0] !== "undefined") {
+                               TYPO3.lang[index] = value[0].target || value[0].source;
+                       } else {
+                               TYPO3.lang[index] = value;
+                       }
                });
 
                delete originalLangObject;