Add text extractor plugins for image, file, text_with_summary and link field types
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3531717. --> Reported by: [valthebald](https://www.drupal.org/user/239562) Related to !703 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Text extractor plugin operates with the string field types (string, string_long etc.) and assumes translatable text is always in the "value" column.</p> <p>This is not the case for composite field types like image (having translatable "alt" and "title" columns) and link ("title" column).</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Add text extractor plugins for image, file, text_with_summary and link field types</li> <li>Check core field types to find other potentially translatable field types.</li> <li>Add a base class for field types to extend with a getColumns() method to specify what properties are available to translate.</li> </ul> <p>Currently file/image field extractors fail without this Core patch: <a href="https://www.drupal.org/project/drupal/issues/3386915#comment-16174131">https://www.drupal.org/project/drupal/issues/3386915#comment-16174131</a></p> <h3 id="test-steps">Test steps</h3> <ol> <li>Check out this branch</li> <li>Enable AI translation module and configure a provider (e.g. Open AI) to use for translations</li> <li>Add at least 1 other language (e.g. Spanish)</li> <li>Add these field types to Node Article: plain text, body (summary enabled), link (title enabled), image (alt &amp; title enabled), file (description enabled).</li> <li>Enable translations for Node article and fields mentioned</li> <li>Create an article in default language (english) filling all the fields mentioned</li> <li>** Note for image/file fields, you must apply the patch at #25 here Currently file/image field extractors fail without this Core patch: <a href="https://www.drupal.org/project/drupal/issues/3386915#comment-16174131">https://www.drupal.org/project/drupal/issues/3386915#comment-16174131</a> or the batch process for creating a translation with fail with exception</li> <li>Click the link in AI Translations column (mine is "Translate using gpt-4.1"</li> <li>Translation should be successful and all fields above should be translated.</li> </ol> <p><strong>custom_field</strong> module (optional):</p> <ol> <li>Check out this branch of custom_field module: <a href="https://www.drupal.org/project/custom_field/issues/3533534">https://www.drupal.org/project/custom_field/issues/3533534</a></li> <li> Enable 'AI Custom Field' (custom_field_ai) sub-module.</li> <li>Add a custom field to article with various subfields, enable translation for field and subfields.</li> <li>Delete spanish translation above and re-run translation and verify the custom field properties are translated</li> </ol> <p><strong>layout builder</strong> (optional)</p> <ol> <li>Enable layout builder core module</li> <li>Enable the article display settings to allow layout builder</li> <li>Add a basic content block in layout with values that can be translated</li> <li>Delete spanish translation above and re-run translation and verify the layout builder output is translated</li> </ol> > Related issue: [Issue #3386915](https://www.drupal.org/node/3386915)
issue