번역기 패키지는 Dart용 무료이고 제한 없는 Google 번역 API를 제공하여 개발자가 여러 언어 간에 문자열과 텍스트를 번역할 수 있도록 합니다. 교육 목적을 위해 설계되었으며 Android, iOS, Web, macOS, Windows, Linux에서 Flutter 앱에 원활하게 통합됩니다. API 키가 필요 없이 Google 번역 웹 인터페이스를 활용하므로 접근성과 사용 용이성이 뛰어납니다. 최소한의 설정으로 기본 번역 기능을 지원하며, 다국어 애플리케이션 학습이나 프로토타이핑에 이상적입니다.
사용 사례
실시간으로 앱 콘텐츠 번역하기
교육용 언어 학습 도구
다국어 인터페이스 프로토타이핑
Flutter 앱에서의 간단한 텍스트 번역
다국어 간 통신 기능
주요 기능
API 키가 필요하지 않습니다
다수의 플랫폼을 지원합니다
무료 및 무제한 사용
Flutter와의 간편한 통합
교육용으로 설계됨
실시간 텍스트 번역
적합한 대상
초보자 플러터 개발자
교육 프로젝트
비상업적 응용 프로그램
빠른 프로토타이핑
기본 번역이 필요한 앱
고려 사항
고-traffice 생산 환경에 적합하지 않습니다
웹 스크래핑에 의존합니다(업데이트로 인해 작동이 중단될 수 있음)
Google 번역에서 지원하는 언어로 제한됨
공식 API 보장 없음
레이트 제한은 웹사이트 행동을 통해 간접적으로 적용될 수 있습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
translator
Free Google Translate API for Dart
See it in pub: https://pub.dev/packages/translator
and GitHub: https://github.com/gabrielpacheco23/google-translator
Usage
voidmain() 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 这意味着用中文'测试'
TranslatedText Widget
Moved TranslatedText widget to https://github.com/gabrielpacheco23/translated_text
API
For full API docs take a look at https://pub.dev/documentation/translator/latest/
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.