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

retracted

A Flutter plugin that extends the standard Text widget to automatically translate text using Google ML Kit on-device translation.

Auto Translate Plugin #

A Flutter plugin for seamless on-device text translation using Google ML Kit. It provides easy-to-use widgets and state management to automatically translate text dynamically within your Flutter application without requiring an active internet connection (once the language models are downloaded).

Features #

  • On-Device Translation: Uses Google ML Kit for privacy-first, offline translations.
  • Easy Integration: Drop-in AutoTranslateText widget that can replace your standard Text widgets.
  • State Management Built-in: Uses a ChangeNotifier to notify all text widgets instantly when the user switches their preferred language.
  • Automatic Model Management: Models for translation are smartly initialized and disposed of dynamically.

Getting started #

Include the plugin in your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  auto_translate_plugin: ^1.0.0
  provider: ^6.1.5

Usage #

  1. Wrap your app in the TranslatorProvider
import 'package:provider/provider.dart';
import 'package:auto_translate_plugin/auto_translate_plugin.dart';

void main() {
  runApp(
    ChangeNotifierProvider(
      create: (_) => TranslatorProvider(),
      child: const MyApp(),
    ),
  );
}
  1. Use the AutoTranslateText widget
AutoTranslateText(
  'Welcome to my application!',
  style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
  textAlign: TextAlign.center,
)
  1. Change the language globally
// Switch the entire app's text from English to Hindi dynamically!
context.read<TranslatorProvider>().changeLanguage('hi');

Additional information #

Ensure you have updated your project dependencies like Google ML Kit and follow platform requirements defined by google_mlkit_translation. The supported list of target languages in the template maps specific codes like ta, hi, te, and ml.

5
likes
0
points
301
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin that extends the standard Text widget to automatically translate text using Google ML Kit on-device translation.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, google_mlkit_translation, provider

More

Packages that depend on auto_translate_plugin