This only affects sites that use the Chat proxy to LLM provider for the Translation operation. Sites translating with DeepL, Google Cloud Translation or another dedicated translation provider see no change.
What changed
The Chat proxy to LLM provider always translated with the default Chat model, and ignored the other model settings. It now uses them, the most specific one first:
- AI model used for translating to (language) at
/admin/config/ai/ai-translate. This value includes the provider, so a language can now be translated by a different provider than the default Chat one. - The model selected for the Translation operation at
/admin/config/ai/settings, run on the default Chat provider. - The default Chat provider and model, as before.
If the provider no longer offers a selected model, or its model list cannot be retrieved, that setting is skipped and the next one is used. A warning is logged in that case.
The per-language select at /admin/config/ai/ai-translate also lists one model that was missing before: the first model of the first chat provider.
Site builders and administrators
Check both settings after updating. They had no effect until now, so they may hold a model you never meant to use, possibly a more expensive one, or another provider for some languages.
To keep the old behaviour:
- Set the Translation operation model at
/admin/config/ai/settingsto the same model as the default Chat model. - Set every per-language model at
/admin/config/ai/ai-translateto - Default from AI module (chat) -.
Also:
- Run
drush updbordrush crafter updating. The module adds a new service, and translations through the chat proxy fail until the container is rebuilt. - If translation caching is enabled, cached translations made through the chat proxy are not reused after the update. Each one is translated again the first time it is requested.
Module developers
hook_ai_translate_translation_alter()now receives the provider and model that will actually run, instead of the Chat defaults. It can also be called more than once per request, for example when several target languages use different models. As before, it is not called for translations served from the cache.- The model choice lives in a new service,
ai_translate.chat_model_resolver(Drupal\ai_translate\ChatModelResolver). Callresolve()when you need to know which provider and model will translate into a given language. - Two protected methods changed signature.
ChatTranslationProvider::loadTranslator()gained two optional parameters, andTextTranslator::providerSignature()gained a requiredLanguageInterface $langToparameter. Subclasses overriding either method need updating.