[MAINTENANCE] Translate Helper Refactoring#1839
[MAINTENANCE] Translate Helper Refactoring#1839marco-lengua wants to merge 23 commits intokitodo:mainfrom
Conversation
…ngua/kitodo-presentation-DFG into feature_translateHelper
…ngua/kitodo-presentation-DFG into feature_translateHelper
…ngua/kitodo-presentation-DFG into feature_translateHelper
| $entryArray['year'] = $entry['year']; | ||
| $entryArray['orderlabel'] = $entry['orderlabel']; | ||
| $entryArray['type'] = $entry['type']; | ||
| $entryArray['type'] = $this->getTranslatedType($entry['type']); |
There was a problem hiding this comment.
This change disables the option to display document type icons. This functions is used for e.g. in DFG Viewer <span class="meta-type-icon meta-type-{child.type}">{child.type}</span>. It is necessary that type is in English instead be translated here.
There was a problem hiding this comment.
thank you for your feedback, i was not aware of this. What i don't understand is why in the current version (branch 6) it is the same way. I think we made the change in one PR and now wanted to revert it. The purpose of this is a batch translation and a speed gain. It was like this before. Could you explain why it would not be working anymore now.
There was a problem hiding this comment.
The use case is as mentioned above, the template contains span with the meta-type-{child.type}, then there is css for this class e.g.
&.meta-type-article {
background-position: -60px -30px;
}
If this is translated than css class is not working anymore.
| <f:format.crop maxCharacters="55" append=" ..."><f:format.htmlspecialchars doubleEncode="false">{child.title}</f:format.htmlspecialchars></f:format.crop> | ||
| </f:then> | ||
| <f:else> | ||
| <f:format.crop maxCharacters="55" append=" ..."><f:format.htmlspecialchars doubleEncode="false"><f:translate key="LLL:EXT:dlf/Resources/Private/Language/locallang_structure.xlf:structure.{child.type}" /></f:format.htmlspecialchars><f:if condition="{child.volume}"> <f:format.htmlspecialchars doubleEncode="false">{child.volume}</f:format.htmlspecialchars></f:if></f:format.crop> |
There was a problem hiding this comment.
Translation should be kept here.
There was a problem hiding this comment.
If we have the translated "entry.Type" we can use that translation in this fluid template, because it makes the page load much faster. That was the purpose of this PR. Do you know any case this is not feasible? Could you please provide me with more information on this topic. Please see also the GitHub Discussion for our usecases

This PR reduces excessive SQL backend querying for single entry translations and lazy loading of single entries to the cache variable. Now we have just a single call to the backend per request and table and PID (retrieving as batch) and else O(1) lookup for translations.