Fixing some spelling and grammar issues that where noted in Dries notes. Also removing redundant warning message about incomplete AI settings on the "User interface translation" form (/admin/config/regional/translate).
With current module when you do not set the default provider + model you get an error message and a warning message about the same thing. I am removing the warning message from ai_translate.module as the function call _ai_translate_check_default_provider_and_model() already provides an error message with the same message.
Before:
if (!_ai_translate_check_default_provider_and_model()) {
$message = t('Please select a default provider and model for translation via the <a href="@ai_settings">AI settings</a> page.', [
'@ai_settings' => Url::fromRoute('ai.settings_form')->toString(),
]);
\Drupal::messenger()->addWarning($message);
}

After:
if (!_ai_translate_check_default_provider_and_model()) {
return;
}

| Comment | File | Size | Author |
|---|---|---|---|
| duplicate_error_message_after.png | 210.32 KB | erichomanchuk | |
| duplicate_error_message_before.png | 95 KB | erichomanchuk |
Issue fork ai-3557038
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3557038-spelling-and-grammar
changes, plain diff MR !1007
1 hidden branch
Issue fork ai_translate-3557038
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3557038-spelling-and-grammar
changes, plain diff MR !9
Comments
Comment #3
erichomanchuk commentedComment #4
vinodhini.e commentedHi, Tested on Drupal 11.2.3
Steps followed:
Installed the AI Translate module.
Navigated to /admin/config/regional/translate without setting a default provider and model.
Encountered the issue — the same message was displayed twice:
Once as an error, and Once as a warning.
After applying MR #1007:
The issue was resolved. Now only a single error message is displayed.
The message also includes correct spelling and grammar. Thanks.
Comment #5
svendecabooterComment #8
svendecabooterCreated a new MR in the ai_translate module, instead of the AI module.
Added the commit by erichomanchuk to that MR.
Changes look good to me.
Comment #9
svendecabooterComment #10
valthebaldComment #15
valthebaldCommitted to 1.3.x and 2.0.x, thanks everyone!