Skip to content

Fix Use the configuration from the AI Translate module

Implement a complete overhaul of the translation system to provide three distinct translation methods, resolving conflicts between AI Translate module and provider- specific translation interfaces.

New Features

Three Translation Methods

  • AI Translate module prompts: Uses AI Translate module's sophisticated per- language prompts and chat-based translation system, completely independent of provider-specific translation methods
  • AI provider translation interface: Uses provider's native translate_text operation with built-in translation logic
  • Basic prompt: Simple chat-based translation with customizable TMGMT prompt

Enhanced UI & Validation

  • Updated form with clear radio button options and comprehensive descriptions
  • Added robust validation for each translation method with helpful error messages
  • Dynamic form states that show/hide relevant fields based on selected method
  • Links to AI settings for easy provider configuration

Architectural Improvements

  • Implements proper delegation logic in doRequest() method
  • Bypasses translate_text operation for AI Translate to avoid provider conflicts
  • Handles ProviderProxy wrapper correctly for provider interface option
  • Uses direct chat interface for AI Translate with Twig template rendering

Technical Details

AI Translate Implementation

  • Directly uses default chat provider to avoid delegation conflicts
  • Reads AI Translate's per-language prompts from ai_translate.settings
  • Renders prompts using Twig with proper language context variables
  • Falls back gracefully when language-specific prompts aren't configured

Provider Interface Implementation

  • Uses standard translate_text operation type for maximum compatibility
  • Removes instanceof check to handle ProviderProxy delegation correctly
  • Properly handles TranslateTextOutput.getNormalized() return values
  • Maintains backward compatibility with existing provider configurations

Documentation Updates

  • Updated README with comprehensive configuration instructions
  • Added clear examples for each translation method
  • Documented requirements and use cases for each option
  • Clarified prompt customization limitations

Breaking Changes

  • Changes model_selection_type option values:
    • 'ai_tmgmt' → 'basic'
    • Adds new 'provider_interface' option
  • Default value changed from empty string to 'basic'

Fixes

  • Resolves AI Translate module using specific provider prompts instead of its own
  • Fixes ProviderProxy instanceof TranslateTextInterface check failures
  • Corrects TranslateTextOutput.getNormalized().getText() method call error
  • Eliminates configuration conflicts between AI Translate and provider interfaces

This implementation provides clear separation of concerns, allowing users to choose the most appropriate translation method for their specific needs while maintaining full compatibility with both AI Translate module's advanced features and provider- specific optimizations.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Closes #3533689

Edited by Scott Euser

Merge request reports

Loading