translator_plus 1.0.1 copy "translator_plus: ^1.0.1" to clipboard
translator_plus: ^1.0.1 copied to clipboard

A free and unlimited Google Translate API for Dart. You can use it for translate strings and text for educational purpose.

example/main.dart

import 'package:translator_plus/translator_plus.dart';

void main() async {
  final translator = GoogleTranslator();
  final input = "Здравствуйте. Ты в порядке?";

  // Using the Future API
  translator
      .translate(input, to: 'en')
      .then((result) => print("Source: $input\nTranslated: $result"));

  // Passing the translation to a variable
  var translation =
      await translator.translate("I would buy a car, if I had money.", from: 'en', to: 'it');

  // You can also call the extension method directly on the input
  print('Translated: ${await input.translate(to: 'en')}');

  // You can also replace the default base URL for countries where the default one doesn't work
  translator.baseUrl = "translate.google.com.hk";
  translator.translateAndPrint("This means 'testing' in chinese", to: 'zh-cn');
  //prints 这意味着用中文'测试'

  print("translation: $translation");
  // prints translation: Vorrei comprare una macchina, se avessi i soldi.
}
copied to clipboard
18
likes
150
points
490
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.23 - 2025.04.07

A free and unlimited Google Translate API for Dart. You can use it for translate strings and text for educational purpose.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on translator_plus