[TYPO3-core] RFC: prepend '[Translate to XY]' on copy only ifvalue is set -- extended

Wolfgang Klinger wolfgang at stufenlos.net
Fri Jan 13 11:54:49 CET 2006


 *hiya!*

 Martin Kutschker schrieb folgendes am 13.01.2006:
> The patch is a bit ... odd. Anyway I guess you can handle the sprintf :-)

 oh, sorry, I forgot the "-u", here it is again...
 (and the code is heavily indented, so you might have to scroll)


 kind regards
 Wolfgang

-------------- next part --------------
--- TYPO3core/t3lib/class.t3lib_tcemain.php	2006-01-12 17:39:21.000000000 +0100
+++ TYPO3core_testing/t3lib/class.t3lib_tcemain.php	2006-01-13 09:44:19.000000000 +0100
@@ -2897,8 +2897,16 @@
 											// Set exclude Fields:
 										foreach($TCA[$table]['columns'] as $fN => $fCfg)	{
 											if ($fCfg['l10n_mode']=='prefixLangTitle')	{	// Check if we are just prefixing:
-												if ($fCfg['config']['type']=='text' || $fCfg['config']['type']=='input')	{
-													$overrideValues[$fN] = '[Translate to '.$langRec['title'].':] '.$row[$fN];
+												if (($fCfg['config']['type']=='text' || $fCfg['config']['type']=='input') && strlen($row[$fN]))	{
+													list($tscPID) = t3lib_BEfunc::getTSCpid($table,$uid,'');
+													$TSConfig = $this->getTCEMAIN_TSconfig($tscPID);
+
+													$translateToMsg = 'Translate to '.$langRec['title'].':';
+													if (isset($TSConfig['translateToMessage']) && strlen($TSConfig['translateToMessage'])) {
+														$translateToMsg = sprintf($TSConfig['translateToMessage'], $langRec['title']);
+													}
+
+													$overrideValues[$fN] = '['.$translateToMsg.'] '.$row[$fN];
 												}
 											} elseif (t3lib_div::inList('exclude,noCopy,mergeIfNotBlank',$fCfg['l10n_mode']) && $fN!=$TCA[$table]['ctrl']['languageField'] && $fN!=$TCA[$table]['ctrl']['transOrigPointerField']) {	 // Otherwise, do not copy field (unless it is the language field or pointer to the original language)
 												$excludeFields[] = $fN;



More information about the TYPO3-team-core mailing list