[BUGFIX] Invalid fallback for non-localized labels
[Packages/TYPO3.CMS.git] / t3lib / l10n / parser / class.t3lib_l10n_parser_xliff.php
index f85f9e3..8606e03 100644 (file)
@@ -57,10 +57,18 @@ class t3lib_l10n_parser_Xliff extends t3lib_l10n_parser_AbstractXml {
                                                );
                                        } else {
                                                        // @todo Support "approved" attribute
-                                               $parsedData[(string)$translationElement['id']][0] = array(
-                                                       'source' => (string)$translationElement->source,
-                                                       'target' => (string)$translationElement->target,
-                                               );
+                                               if (!empty($translationElement->target)) {
+                                                       $parsedData[(string)$translationElement['id']][0] = array(
+                                                               'source' => (string)$translationElement->source,
+                                                               'target' => (string)$translationElement->target,
+                                                       );
+                                               } else {
+                                                               // No target element => not yet translated
+                                                       $parsedData[(string)$translationElement['id']][0] = array(
+                                                               'source' => (string)$translationElement->source,
+                                                               'target' => (string)$translationElement->source,
+                                                       );
+                                               }
                                        }
                                } elseif ($translationElement->getName() === 'group' && isset($translationElement['restype']) && (string)$translationElement['restype'] === 'x-gettext-plurals') {
                                                // This is a translation with plural forms
@@ -79,10 +87,18 @@ class t3lib_l10n_parser_Xliff extends t3lib_l10n_parser_AbstractXml {
                                                                );
                                                        } else {
                                                                        // @todo Support "approved" attribute
-                                                               $parsedTranslationElement[(int)$formIndex] = array(
-                                                                       'source' => (string)$translationPluralForm->source,
-                                                                       'target' => (string)$translationPluralForm->target,
-                                                               );
+                                                               if (!empty($translationPluralForm->target)) {
+                                                                       $parsedTranslationElement[(int)$formIndex] = array(
+                                                                               'source' => (string)$translationPluralForm->source,
+                                                                               'target' => (string)$translationPluralForm->target,
+                                                                       );
+                                                               } else {
+                                                                               // No target element => not yet translated
+                                                                       $parsedTranslationElement[(int)$formIndex] = array(
+                                                                               'source' => (string)$translationPluralForm->source,
+                                                                               'target' => (string)$translationPluralForm->source,
+                                                                       );
+                                                               }
                                                        }
                                                }
                                        }