Coder Social home page Coder Social logo

Comments (14)

chrode avatar chrode commented on August 24, 2024 3

The TCA is missing a parameter that handles the connection in the TYPO3 backend.

Please add

'transOrigPointerField' => 'l18n_parent',

to https://github.com/kitodo/kitodo-presentation/blob/master/Configuration/TCA/tx_dlf_metadata.php#L21 and the backend will show the connection as before.

This should be done inside any TCA field configuration file that wants this behaviour.

The "localize to" button is only showing when you have a translation of this page.

from kitodo-presentation.

beatrycze-volk avatar beatrycze-volk commented on August 24, 2024 3

The TCA is missing a parameter that handles the connection in the TYPO3 backend.

Thanks a lot for help! :)

Now the question is why was it removed.

@chrizzor could you explain what was a purpose of the change which you have made here 6a1ae83 ?

What still bothers me is the divergence in data format between the original and translation.

It is the next problem which I'm going to work on.

from kitodo-presentation.

beatrycze-volk avatar beatrycze-volk commented on August 24, 2024 2

Actually the main reason why the format is not synchronized is already mentioned above empty l18n_diffsource. It is caused by usage of Extbase in NewTenantController. Extbase directly writes to the database, and thus bypasses DataHandler. DataHandler is actually the one which is responsible for the localization of records.

It is not possible to assign the same format to both metadata records in the controller as the format record is first created on the save, so when I add something like:
$translatedRecord->setFormat($newRecord->getFormat());
Extbase create new record which is attached to translated metadata and ignores original record. So in the current implementation new format record can be attached to original record or translated but not both.

Synchronization happens first after updating record in backend - l18n_diffsource is filled again. I have re-saved simply translation for Strukturtyp and then DataHandler has done its job:

INSERT INTO `tx_dlf_metadata`
VALUES (95,2,1708696735,1708696577,0,0,1,96,'a:17:{s:5:\"label\";s:11:\"Strukturtyp\";s:13:\"default_value\";s:0:\"\";s:16:\"sys_language_uid\";i:0;s:11:\"l18n_parent\";i:0;s:6:\"hidden\";i:0;s:4:\"wrap\";s:64:\"key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>\";s:10:\"index_name\";s:4:\"type\";s:6:\"format\";i:1;s:15:\"index_tokenized\";i:0;s:12:\"index_stored\";i:1;s:13:\"index_indexed\";i:0;s:11:\"index_boost\";d:1;s:11:\"is_sortable\";i:1;s:8:\"is_facet\";i:1;s:9:\"is_listed\";i:1;s:18:\"index_autocomplete\";i:0;s:6:\"status\";i:0;}',0,0,'{\"wrap\":\"parent\"}','Typee','type',1,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,1,0,1,1,1,1,0,0),
       (96,2,1708696577,1708696577,0,0,0,0,'',0,0,NULL,'Strukturtyp','type',1,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,1,0,1,1,1,1,0,0),
       (97,2,1708696577,1708696577,0,0,1,98,'',0,0,NULL,'Title','title',0,'','key.wrap = <dt class=\"tx-dlf-metadata-title\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-title\">|</dd>',0,0,0,1,0,0,0,0,0),
       (98,2,1708696577,1708696577,0,0,0,0,'',0,0,NULL,'Titel','title',3,'','key.wrap = <dt class=\"tx-dlf-metadata-title\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-metadata-title\">|</dd>',1,1,1,2,1,0,1,1,0)
datahandler

Currently there is no way to force DataHandler to accept Extbase entities. We would need to transform those entities into data maps (so basically revert changes to the old state before update).

@sebastian-meyer should we revert to old saving method of data maps or accept it as bug and wait until TYPO3 provide someday possibility to localize Extbase entities with DataHandler?

from kitodo-presentation.

stweil avatar stweil commented on August 24, 2024 1

Please add the milestone Kitodo.Presentation 5.0.0.

from kitodo-presentation.

beatrycze-volk avatar beatrycze-volk commented on August 24, 2024 1

First thanks for description of the error!

I have suspicion what can be the cause for this error.

This are exemplary DB entries for Type/Strukturtyp:

# v3.3.x:
INSERT INTO `tx_dlf_metadata` VALUES (28,3,1706263174,1706263174,2,0,0,0,'a:16:{s:5:\"label\";N;s:10:\"index_name\";N;s:15:\"index_tokenized\";N;s:12:\"index_stored\";N;s:13:\"index_indexed\";N;s:11:\"index_boost\";N;s:11:\"is_sortable\";N;s:8:\"is_facet\";N;s:9:\"is_listed\";N;s:18:\"index_autocomplete\";N;s:6:\"format\";N;s:13:\"default_value\";N;s:4:\"wrap\";N;s:16:\"sys_language_uid\";N;s:6:\"hidden\";N;s:6:\"status\";N;}',1,1026,NULL,'Strukturtyp','type',0,'','key.wrap = <dt class=\"tx-dlf-type\">|</dt>\nvalue.required = 1\nvalue.wrap = <dd class=\"tx-dlf-type\">|</dd>',0,1,1,1,0,0,1,0,0);
INSERT INTO `tx_dlf_metadata` VALUES (29,3,1706263174,1706263174,2,0,1,30,'a:3:{s:16:\"sys_language_uid\";N;s:11:\"l18n_parent\";N;s:6:\"format\";N;}',0,1025,NULL,'Context','context0',1,'','key.wrap = <dt>|</dt><dd>\nvalue.required = 1\nvalue.noTrimWrap = || &gt; |\nall.substring = 0,-6\nall.wrap = |</dd>',0,1,1,1,0,0,1,0,0);

It would be very helpful if you could you give me correct log for insert to database. It looks here as there are copied lines for two different metadata - type and context. Already basing on it I assume that currently Kitodo.Presentation inserts double the same label instead label with suffix 0 (in your example context0 looks like translation for context, so basing on it type should get translation with type0) for translated records.

I will make necessary change and report back here :)

from kitodo-presentation.

csidirop avatar csidirop commented on August 24, 2024 1

Here are some database dumps for you (renamed to .txt to allow upload).

-> "3.x" is from presentation 3.3.4, while "4.x" from a recent version.
-> "Trimmed" contain only the tables tx_dlf_metadata, tx_dlf_metadataformat and tx_dlf_structures.

I have a setup with DFG-Viewer if that makes any difference.

Here two examples with year and place:
presentation 3.3.4:

#tx_dlf_metadata:
INSERT INTO `tx_dlf_metadata` VALUES (1,3,1707475705,1707475705,2,0,1,17,'a:2:{s:16:\"sys_language_uid\";N;s:11:\"l18n_parent\";N;}',0,2304,'{\"wrap\":\"parent\"}','Year of Publication','year0',0,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,0,1,1,0,0,0,0,0);
INSERT INTO `tx_dlf_metadata` VALUES (2,3,1707475705,1707475705,2,0,1,18,'a:3:{s:16:\"sys_language_uid\";N;s:11:\"l18n_parent\";N;s:6:\"format\";N;}',0,2176,NULL,'Place of Publication','place0',1,'','key.wrap = <dt>|</dt>\nvalue.ifEmpty.field = parentPlace\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,1,1,1,0,0,1,0,0);
[...]
INSERT INTO `tx_dlf_metadata` VALUES (17,3,1707475705,1707475705,2,0,0,0,'a:1:{s:6:\"hidden\";N;}',0,1540,NULL,'Erscheinungsjahr','year',0,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,0,1,1,0,0,0,0,0);
INSERT INTO `tx_dlf_metadata` VALUES (18,3,1707475705,1707475705,2,0,0,0,'a:1:{s:6:\"format\";N;}',0,1538,NULL,'Erscheinungsort','place',1,'','key.wrap = <dt>|</dt>\nvalue.ifEmpty.field = parentPlace\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,1,1,1,0,0,1,0,0);

#tx_dlf_structures: 'place' dont exists
INSERT INTO `tx_dlf_structures` VALUES (2,3,1707475705,1707475705,2,0,1,91,'a:2:{s:16:\"sys_language_uid\";N;s:11:\"l18n_parent\";N;}',0,NULL,1,'Year of Publication','year0','',0,0);
[...]
INSERT INTO `tx_dlf_structures` VALUES (91,3,1707475705,1707475705,2,0,0,0,'a:8:{s:8:\"toplevel\";N;s:5:\"label\";N;s:10:\"index_name\";N;s:8:\"oai_name\";N;s:9:\"thumbnail\";N;s:16:\"sys_language_uid\";N;s:6:\"hidden\";N;s:6:\"status\";N;}',0,NULL,1,'Jahr','year','',0,0);

presentation 4.1:

#tx_dlf_metadata:
INSERT INTO `tx_dlf_metadata` VALUES (29,3,1707475374,1707475374,0,0,1,'',0,0,30,'Place of Publication','place',0,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,0,0,1,0,0,0,0,0);
INSERT INTO `tx_dlf_metadata` VALUES (30,3,1707475374,1707475374,0,0,0,'',0,0,0,'Erscheinungsort','place',3,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',1,1,1,1,1,1,1,0,0);
[...]
INSERT INTO `tx_dlf_metadata` VALUES (31,3,1707475374,1707475374,0,0,1,'',0,0,32,'Year of Publication','year',0,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,0,0,1,0,0,0,0,0);
INSERT INTO `tx_dlf_metadata` VALUES (32,3,1707475374,1707475374,0,0,0,'',0,0,0,'Erscheinungsjahr','year',4,'','key.wrap = <dt>|</dt>\nvalue.required = 1\nvalue.wrap = <dd>|</dd>',0,1,1,1,1,1,1,0,0);

#tx_dlf_structures: ('place' dont exists)
INSERT INTO `tx_dlf_structures` VALUES (183,3,1707475361,1707475361,0,0,0,'',0,0,1,'Jahr','year','',0,0);
INSERT INTO `tx_dlf_structures` VALUES (184,3,1707475361,1707475361,0,0,1,'',0,183,0,'Year','year','',0,0);

from kitodo-presentation.

beatrycze-volk avatar beatrycze-volk commented on August 24, 2024 1

Thanks for detailed description :)

So my changes are removing necessity of renaming the index_name field but there is still missing this part 'a:8:{s:8:\"toplevel\";N;s:5:\"label\";N;s:10:\"index_name\";N;s:8:\"oai_name\";N;s:9:\"thumbnail\";N;s:16:\"sys_language_uid\";N;s:6:\"hidden\";N;s:6:\"status\";N;}' . I need to figure out how this one was generated previously and why it has gone missing.

from kitodo-presentation.

beatrycze-volk avatar beatrycze-volk commented on August 24, 2024 1

Not sure if this is related, but when changing the language the metadata still stays German

It looks that the records which should be used as translation are not treated as translation, more like the separated records. So the both problems are very likely related to each other. Actually the reason must lie in this empty l18n_diffsource field.

from kitodo-presentation.

csidirop avatar csidirop commented on August 24, 2024 1

I added the missing in tx_dlf_metadata.php and tx_dlf_structures, and that worked.

But maybe we need to add this also to tx_dlf_basket.php, tx_dlf_collections.php and tx_dlf_libraries.php. At least those had the languageField and transOrigDiffSourceField field too.

from kitodo-presentation.

beatrycze-volk avatar beatrycze-volk commented on August 24, 2024

#1169

from kitodo-presentation.

csidirop avatar csidirop commented on August 24, 2024

Let me know if I can help in any way

from kitodo-presentation.

csidirop avatar csidirop commented on August 24, 2024

Not sure if this is related, but when changing the language the metadata still stays German:
viewer-metadata
Unfortunately @BFallert can't reproduce this error. Can you?

Ps.: I updated the original post, with additional informations.

from kitodo-presentation.

BFallert avatar BFallert commented on August 24, 2024

I get a different error: In my case, all metadata that I have edited or put in a different order / sequence disappears in the english version. When saving in typo3, the IndexName is of course also supplemented by "0" if it already exists for another language, as an IndexName may only occur once.

from kitodo-presentation.

csidirop avatar csidirop commented on August 24, 2024

Worked for me:
grafik

What still bothers me is the divergence in data format between the original and translation.

from kitodo-presentation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.