パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.1

translator_plus

Dart用の無料で制限なしのGoogle翻訳API。教育的目的で文字列やテキストを翻訳するために使用できます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
502
いいね数
19
Pub ポイント
145

パッケージをインストール

flutter pub add translator_plus

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

translator_plus は、Google 翻訳機能への無料かつ無制限のアクセスを提供する Dart パッケージであり、開発者が複数の言語間でテキストや文字列を翻訳できるようにします。教育目的に設計されており、Android、iOS、Web、macOS、Windows、Linux を含むすべての主要プラットフォームをサポートしています。API キーや複雑な設定なしに Flutter アプリに翻訳機能を簡単に統合できます。国際化の概念を学ぶか、最小限のオーバーヘッドで多言語アプリを構築するのに最適です。

用途

  • リアルタイムでアプリコンテンツを翻訳する
  • 言語変換を含む教育プロジェクト
  • マルチリンガルプロトタイプの構築
  • ユーザー向けテキストのローカライズ
  • アプリでの非英語ユーザーのサポート

主な機能

  • APIキーは必要ありません
  • 無料で無制限の利用
  • クロスプラットフォーム対応
  • テキスト翻訳のためのシンプルな API
  • 組み込み言語検出

適している対象

  • 初心者のFlutter開発者
  • 教育アプリケーション
  • マルチリンガルアプリのプロトタイピング
  • グローバルな視聴者をターゲットにしたアプリ
  • 迅速な翻訳統合が必要なプロジェクト

注意事項

  • 教育的目的のみを想定しています
  • 高トラフィックのプロダクションアプリには推奨されません
  • Google翻訳のパブリックインターフェースに依存しています
  • Googleによるレート制限または変更の対象となる可能性があります
  • 翻訳品質に対する制御が限られている

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

translator_plus

Free Google Translate API for Dart

See it in pub: https://pub.dev/packages/translator_plus
and GitHub: https://github.com/HusamAwad2001/translator_plus

Usage

void main() async {
  final translator = GoogleTranslator();

  final input = "Здравствуйте. Ты в порядке?";

  translator.translate(input, from: 'ru', to: 'en').then(print);
  // prints Hello. Are you okay?
  
  var translation = await translator.translate("Dart is very cool!", to: 'pl');
  print(translation);
  // prints Dart jest bardzo fajny!

  print(await "example".translate(to: 'pt'));
  // prints exemplo
}

 

Using translate method passing the args from and to designates the language from text you're typing and the language to be translated

translator.translate("I love Brazil!", from: 'en', to: 'pt').then((s) {
    print(s);
  }); 
  // prints Eu amo o Brasil!

 

or you can omit from language and it'll auto-detect the language of source text

translator.translate("Hello", to: 'es').then(print);
// prints Hola

 

and also pass the value to a var using await

var translation = await translator.translate("I would buy a car, if I had money.", from: 'en', to: 'it');
print(translation);
// prints Vorrei comprare una macchina, se avessi i soldi.

 

The returned value is a Translation object which holds the translation stuff

var translation = await translator.translate('Translation', from: 'en', to: 'es');
print('${translation.source} (${translation.sourceLanguage}) == ${translation.text} (${translation.targetLanguage})');

// prints Translation (English) == Traducción (Spanish)

 

You can use the extension method directly on the string too

print(await "example".translate(to: 'pt'));
// prints exemplo

 

There is translateAndPrint method that prints directly

translator.translateAndPrint("This means 'testing' in chinese", to: 'zh-cn');
// prints 这意味着用中文'测试'

 

API

For full API docs take a look at https://pub.dev/documentation/translator_plus/latest/

License

MIT License

Copyright © 2023 Husam Dahliz

Disclaimer

This package is developed for educational purposes only. Do not depend on this package as it may break anytime as it is based on crawling the Google Translate website. Consider buying Official Google Translate API for other types of usage.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト