When you request a translation, the extraction of strings is done by Helpers::extractStringsFromNode
, but this function doesn't utilise any of the TMGMT data functions.
This severely complicates the function itself and limits the number of translatable strings it extracts. In addition, the function doesn't just handle extraction for nodes, but for all entities (custom blocks, menu links, etc.) and its name should reflect that.
Create a node with paragraphs and attempt to translate it. Only the title will be extracted.
Re-write the extraction function so that it uses the tmgmt.data
service, which flattens and filters the data array for us automagically.
Helpers::extractStringsFromNode
function to use \Drupal::service('tmgmt.data')->filterTranslatable($data)
Helpers::parseRemoteTranslations
function to use \Drupal::service('tmgmt.data')->>unflatten($translations)
Possibly the name of the extractStringsFromNode
function should change to extractStringsFromEntity
and a few redundant functions (e.g. getKeysToIgnore
) need to be removed.
Previously the keys generated for fields followed a $fieldName . '_' $propCount
pattern, but now they use the MTGMT concatenation of all nested keys. E.g. title_0
becomes title][0][value
, field_body_0
becomes field_body][0][value
, and as an example a previously excluded paragraph would become field_paragraph][0][entity][field_body][0][value
.
Needs review
1.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.