[TYPO3-core] RFC: prepend '[Translate to XY]' on copy only if value is set -- extended
Wolfgang Klinger
wolfgang at stufenlos.net
Fri Jan 13 09:50:03 CET 2006
*hiya!*
Martin Kutschker:
> > This patch prepends [Translate to XY] only if the field definitely
> > contains a value (strlen check).
>
> How about a TCEMAIN.translateToMessage property in case the default language is not English?
Good idea.
I extended the patch, see attached diff.
You can set something like this in the page properties:
----
TCEMAIN.translateToMessage = Bitte in "%s" übersetzen:
----
and this will be prepended on copying a record:
----
[Bitte in "Spanisch" übersetzen:] test
----
Documentation changes:
http://typo3.org/documentation/document-library/doc_core_tsconfig/gt_TCEMAIN/
Page TSconfig, TCEMAIN
Property: translateToMessage
Value: String
Defines the string that will be prepended to every field value
if you copy an element to another language version.
A "%s" will be replaced by the language title.
Default ist "Translate to [language title]:".
Example: see above
kind regards
Wolfgang
-------------- next part --------------
2900,2901c2900,2909
< 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];
More information about the TYPO3-team-core
mailing list