apiverve_translator 1.2.6
apiverve_translator: ^1.2.6 copied to clipboard
Translator is a language translation API that translates plain text or HTML into target languages using standard language codes. Submit any string with a target language code to receive the translated [...]
Translator API - Dart/Flutter Client #
Translator is a language translation API that translates plain text or HTML into target languages using standard language codes. Submit any string with a target language code to receive the translated text, both language names, and the confirmed or auto-detected source language.
This is the Dart/Flutter client for the Translator API.
Installation #
Add this to your pubspec.yaml:
dependencies:
apiverve_translator: ^1.2.6
Then run:
dart pub get
# or for Flutter
flutter pub get
Usage #
import 'package:apiverve_translator/apiverve_translator.dart';
void main() async {
final client = TranslatorClient('YOUR_API_KEY');
try {
final response = await client.execute({
'text': 'I\'m so excited that tomorrow is going to be sunny! Can\'t wait!',
'source': 'en',
'target': 'es'
});
print('Status: ${response.status}');
print('Data: ${response.data}');
} catch (e) {
print('Error: $e');
}
}
Response #
{
"status": "ok",
"error": null,
"data": {
"sourceLang": "en",
"targetLang": "es",
"translatedText": "¡Estoy tan emocionada de que mañana vaya a hacer sol! ¡Qué ganas tengo!",
"sourceLangName": "English",
"targetLangName": "Spanish",
"sourceDetected": false,
"format": "text",
"characterCount": 62
}
}
API Reference #
- API Home: Translator API
- Documentation: docs.apiverve.com/ref/translator
Authentication #
All requests require an API key. Get yours at apiverve.com.
License #
MIT License - see LICENSE for details.
Built with Dart for APIVerve