Schema errors for ai_translate.settings

Created on 15 July 2025, about 2 months ago

Problem/Motivation

When having several languages enabled and visiting the config form for the prompt translations (at /admin/config/ai/ai-translate), the form will generate a prompt and a model config for each language.

The problem is that, when saving this form, configuration is saved as is:

use_ai_translate: 1
prompt: '...'
en_model: '...'
en_prompt: '...'
fr_model: '...'
fr_prompt: '...'
# etc.

This makes it hard to provide a proper schema, as these configs are not predictable.

In addition, it produces the following warning message:

Schema errors for ai_translate.settings with the following errors: ai_translate.settings:entity_reference_depth missing schema, ai_translate.settings:en_model missing schema, ai_translate.settings:en_prompt missing schema, ai_translate.settings:fr_model missing schema, ai_translate.settings:fr_prompt missing schema, ai_translate.settings:de_model missing schema, ai_translate.settings:de_prompt missing schema. These errors mean there is configuration that does not comply with its schema.

Steps to reproduce (required for bugs, but not feature requests)

  1. Enable ai_translation
  2. Add several languages to your website
  3. Visit /admin/config/ai/ai-translate
  4. Save the form (with or without changes)
  5. You should see a warning message about schema (as above).

Proposed resolution

There is no simple fix for this as it requires a bit of revamping (and probably a hook_update).
I think one approach would be to put these configs under a predictable name, such as "language_settings", so we can describe it properly in ai_translate.schema.yml.

Remaining tasks

- Revamping ai/modules/ai_translate/src/Form/AiTranslateSettingsForm.php form
- Revamping ai_translate.schema.yml to provide the proper schema
- Identifying where this config is used, to update the way they are retrieved
- Writing a hook_update to move the config in their new config object (language_settings).
- Adding / Updating tests

Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)

Any suggestions to fix this is welcomed.

🐛 Bug report
Status

Active

Version

1.1

Component

AI Translate

Created by

🇭🇷Croatia Aporie

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

Comments & Activities

Production build 0.71.5 2024