Bug #42390
closedInsert Record: l10n support
Added by Felix Kopp about 12 years ago. Updated about 5 years ago.
0%
Description
When inserting a content element of the type "Insert Record" within an multi language setup the referenced record is not fetched in the current language overlay.
Standard functionality should be to display the correct language overlay respecting the language handling configuration.
Files
typo3_insert_records.png (107 KB) typo3_insert_records.png | Markus Mächler, 2019-09-23 15:24 |
Updated by Felix Kopp about 12 years ago
There is a work around in the German blog at
http://typo3blogger.de/extension-insertrecordfix-turchen-23/
Perhaps there is a better solution for handling in multi language setup?
Updated by Georg Ringer about 12 years ago
this has to be configurable because this way is also very nice to show content elements from other languages by intention!
Updated by Benni Mack about 12 years ago
- Status changed from New to Accepted
- Assignee set to Benni Mack
- Target version set to 6.1.0
- Complexity set to medium
Yeah, it would be nice if each CE itself has an option for that. This would make the existing feature "Insert Records" a killer feature for multilanguage setups. Shouldn't be too hard. I'll see if I can come up with sth (probably for 6.1 as Feature Freeze has already happened for 6.0).
Updated by Lorenz Ulrich over 11 years ago
Do you have an update concerning this feature? Is it still planned for 6.1?
FYI, Georg's extension insertrecordfix still works with 6.0.
Updated by Lorenz Ulrich almost 10 years ago
I put this on Github:
https://github.com/visol/ext-insertrecordfix
Updated by Felix Kopp almost 10 years ago
- Is Regression set to No
Hey Lorenz, could send a Bugfix for TYPO3 CMS please?
Updated by Markus Hölzle over 7 years ago
Which config.sys_language_overlay was set here? I thought I've got the same issue, but my "config.sys_language_overlay" wasn't set.
If you set config.sys_language_overlay to "hideNonTranslated" or "1" everything works as expected (tested with TYPO3 7.6, TYPO3 8.7 and current master):
config.sys_language_overlay = hideNonTranslated
Documentation: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#sys-language-overlay
I think we can close this issue.
Updated by Riccardo De Contardi about 7 years ago
- Category set to Localization
- Status changed from Accepted to Needs Feedback
Felix, could you test if the solution reported on comment 9 works for you? Thank you!
Updated by Riccardo De Contardi almost 7 years ago
- Related to Bug #82262: Content element "insert records" in an multilang environment added
Updated by Riccardo De Contardi almost 7 years ago
- Status changed from Needs Feedback to Closed
- Assignee deleted (
Benni Mack)
I close this for now... there has been no activity since several months, and the proposed solution (comment 9) works (I tested it with version 7.6.x)
If you think that this is the wrong decision or experience the issue again or that there is still work to be done, pleae reopen it or open a new issue with a reference to this one. Thank you.
Updated by Markus Mächler about 5 years ago
- File typo3_insert_records.png typo3_insert_records.png added
Riccardo De Contardi wrote:
I close this for now... there has been no activity since several months, and the proposed solution (comment 9) works (I tested it with version 7.6.x)
If you think that this is the wrong decision or experience the issue again or that there is still work to be done, pleae reopen it or open a new issue with a reference to this one. Thank you.
Setting config.sys_language_overlay to hideNonTranslated or 1 does only work for the frontend. In the backend we still see the content in the default language (tested with TYPO3 9), which is very confusing for editors, especially for editors locked to certain languages. In addition I would argue that probably even for config.sys_language_overlay = 0 we should try to get a reference to a translated record when the element is translated initially.
Updated by Markus Mächler about 5 years ago
- TYPO3 Version changed from 6.0 to 9
If you wish to have a language overlay for shortcut elements even if you have config.sys_language_overlay = 0, you can install the following extension: https://github.com/visol/ext-insertrecordfix (works also with TYPO3 v8)
However this only works for the frontend. For the backend you could use the gridelements feature basic.overlayShortcutTranslation, which can be set as an extension configuration in the extension manager.
This however does not change the reference in the translated element, it will still point to the record in the default language. It does also not allow for a reference to the default language as the overlay will always happen if a translation exists.
Thus we have implemented a workaround that overwrites the records field when a shortcut element gets translated. This however does not fix existing shortcut elements with a wrong reference.
DataHandler.php
<?php
namespace Your\Extension\Hooks;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class DataHandler {
/**
* @param string $status
* @param string $table
* @param integer $id
* @param array $fieldArray
* @param \TYPO3\CMS\Core\DataHandling\DataHandler $pObj
*/
public function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$pObj)
{
if ($status === 'new' && $table === 'tt_content' && $fieldArray['CType'] === 'shortcut') {
//Fix localization of shortcuts to point to localized record instead of record in default language, see https://forge.typo3.org/issues/42390
$explodedRecords = GeneralUtility::trimExplode(',', $fieldArray['records'], true);
$newRecords = [];
foreach ($explodedRecords as $oldRecord) {
$tableIdSplit = BackendUtility::splitTable_Uid($oldRecord);
$tableName = $tableIdSplit[0];
$oldRecordUid = (int) $tableIdSplit[1];
$newRecordUid = $oldRecordUid;
if ($oldRecordUid > 0) {
$translatedRecord = BackendUtility::getRecordLocalization($tableName, $oldRecordUid, $fieldArray['sys_language_uid']);
if (is_array($translatedRecord[0])) {
$newRecordUid = (int) $translatedRecord[0]['uid'];
}
}
$newRecords[] = $tableName . '_' . $newRecordUid;
}
$fieldArray['records'] = implode(',', $newRecords);
}
}
}
ext_tables.php
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][$_EXTKEY] = Your\Extension\Hooks\DataHandler::class;