TranslationService class

Enhanced translation service with retry logic, rate limiting, and comprehensive error handling.

This class provides robust translation capabilities using multiple translation APIs with intelligent fallback mechanisms and rate limiting to prevent API abuse.

Constructors

TranslationService(TranslatorConfig _config)
Creates a TranslationService with the given config.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearMemory() → void
Gets AI provider statistics. Clears translation memory.
dispose() Future<void>
Disposes of the HTTP client resources.
getAIProviderStats() Map<String, dynamic>
Gets AI provider statistics and health information.
getCostEstimates(String text) Map<TranslationProvider, double>
Gets cost estimates for translating text with all available providers.
getMemoryStats() Map<String, dynamic>
Gets translation memory statistics.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
testAIProviders() Future<Map<TranslationProvider, bool>>
Tests all AI providers to ensure they're working correctly.
toString() String
A string representation of this object.
inherited
translateBatch(Map<String, String> translations, String targetLang, {String? sourceLang}) Future<Map<String, String>>
Translates multiple texts concurrently with proper throttling.
translateText(String text, String targetLang, {String? sourceLang, String? description, Map<String, String>? surroundingContext, String? keyName}) Future<String>
Translates the given text into the specified targetLang.

Operators

operator ==(Object other) bool
The equality operator.
inherited