diff --git "a/c:\\tmp\\claD1.tmp\\class.t3lib_tcemain-HEAD-left.php" "b/V:\\htdocs-gw\\typo3_src-4.5.sg\\t3lib\\class.t3lib_tcemain.php" index 57c67eb..6da2591 100644 --- "a/c:\\tmp\\claD1.tmp\\class.t3lib_tcemain-HEAD-left.php" +++ "b/V:\\htdocs-gw\\typo3_src-4.5.sg\\t3lib\\class.t3lib_tcemain.php" @@ -3842,7 +3842,17 @@ class t3lib_TCEmain { } } } else { - $this->newlog('Localization failed; There already was a localization for this language of the record!', 1); + // $this->newlog('Localization failed; There already was a localization for this language of the record!', 1); + $newId = $this->adjustExistingTranslation($table, $uid, $langRec['uid'], $row); + if (!$newId) { + $this->newlog('Localization failed in table "'.$table.'"; '. + ' For this record (uid='.$uid.') there already was a localization for this language (L='.$langRec['uid'].') '. + ' of the record!', 1); + } else { + $this->newlog('Note about localization in table "'.$table.'"; '. + ' For this record (uid='.$uid.') there already was a localization for this language (L='.$langRec['uid'].') '. + ' of the record! Inline references will be adjusted for NewID = '.$newId . ' (ID of existing trasnlated record)', 0); + } } } else { $this->newlog('Localization failed; Source record contained a reference to an original default record (which is strange)!', 1); @@ -7250,6 +7260,23 @@ class t3lib_TCEmain { return $elements; } + + + protected function adjustExistingTranslation($table, $origUid, $language_uid, array $origRow) { + $newId = FALSE; + + if ($table !== 'pages') { + $existingTranslations = t3lib_BEfunc::getRecordLocalization($table, $origUid, $language_uid, 'AND pid=' . intval($origRow['pid'])); + if (count($existingTranslations)==1) { + $record = reset($existingTranslations); + $newId = $record['uid']; + } + } + + return $newId; + } + + }