AI Translate: controller override not triggered if installed via recipe

Created on 4 June 2025, 3 days ago

Problem/Motivation

I enable and configure the ai_translate module via a recipe.
After recipe installation, the translation controller is not overridden, so not showing the "Translate using ..." link.

When explicitly saving the configuration form, it does work.
Seems like this is triggered by \Drupal\ai_translate\Form\AiTranslateSettingsForm::submitForm.
But upon recipe installation, this does not get triggered...

Steps to reproduce

Install the module via a recipe, and try to translate a content item.

🐛 Bug report
Status

Active

Version

1.1

Component

AI Translate

Created by

🇧🇪Belgium svendecabooter Gent

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @svendecabooter
  • First commit to issue fork.
  • Pipeline finished with Success
    3 days ago
    Total: 213s
    #514553
  • 🇮🇳India sarvjeetsingh

    I've been able to reproduce this issue with AI module 1.1.x and have identified the cause. I've also created a merge request with the fix.

    The issue occurs because the default configuration file config/install/ai_translate.settings.yml is missing the use_ai_translate setting. This creates a confusing situation:
    Settings form shows: Checkbox is checked (due to fallback: $config->get('use_ai_translate') ?? TRUE)
    Actual configuration: use_ai_translate setting doesn't exist (NULL value)
    Hence it only worked when we manually saved the AiTranslateSettingsForm.

    Recipe that i used:

    name: 'AI Translate'
    description: 'Enables AI-powered content translation'
    type: 'Feature'
    
    install:
      - ai_translate
    

    Kindly review!

  • 🇮🇳India anjaliprasannan

    The fix is working fine. Moving to RTBC
    Steps followed:
    Created folder recipes/ai_translate with file recipe.yml file in root.

    name: 'AI Translate'
    description: 'Enables AI-powered content translation'
    type: 'Feature'
    
    install:
      - ai_translate

    configured translate text in ai default settings and try to translate any content
    Translate using ... option available.

    Screeshots attached.

  • 🇧🇪Belgium svendecabooter Gent

    Thanks for looking into this sarvjeetsingh.
    It hadn't occurred to me that this could be the source of the issue.
    Fix in MR resolves the issue for me.

Production build 0.71.5 2024