offline_translator 0.0.2 copy "offline_translator: ^0.0.2" to clipboard
offline_translator: ^0.0.2 copied to clipboard

A Flutter package for offline translation without any json or arb files.

🈳 Offline Translator #

A Flutter package for completely offline translation β€” no internet, no external files, fully self-contained.

Flutter Dart Platforms

πŸš€ Features #

  • Offline translations: Works without internet.
  • Multiple languages supported: English, French, Spanish, Urdu, Arabic, Chinese (en, fr, es, ur, ar, zh).
  • No extra files required: JSON/ARB-free.
  • Easy integration: Works like Flutter’s Text() widget.
  • Lightweight, fast, and reliable.

🎯 Getting Started #

1️⃣ Add Dependency #

dependencies: offline_translator: ^0.0.1

2️⃣ Initialize Translator #

void main() async { WidgetsFlutterBinding.ensureInitialized();

await OfflineTranslator.init( defaultLang: 'en', langs: ['en', 'fr', 'es', 'ur', 'ar', 'zh'], );

runApp(const MyApp()); }

3️⃣ Wrap App with Provider #

class MyApp extends StatelessWidget { const MyApp({super.key});

@override Widget build(BuildContext context) { return ChangeNotifierProvider( create: (_) => TranslationProvider( defaultLang: 'en', supportedLangs: ['en','fr','es','ur','ar','zh'], ), child: const MaterialApp(home: HomePage()), ); } }

usage dynamically #

Translated TranslatedText("Offline Translator Package"),

πŸ’‘ Key Advantages #

  • Dynamic placeholders: Easily replace text like "Welcome {name}".
  • Offline-first: Ideal for apps with no internet connectivity.
  • **android & iOS: Works on android & iOS 16+ and all Flutter-supported platforms.

πŸ“Œ Example Usage #

// Translate dynamically with parameters TranslatedText("Welcome {name}", params: {"name": "Ahmed"});

default langauge at run time #

provider.setLanguage('en'); // UI automatically updates

πŸ† Why Choose Offline Translator? #

βœ… No network dependency βœ… Multi-language support βœ… Fast, lightweight, and simple API βœ… Perfect for mobile apps requiring offline capabilities

Supported Languages:

Supported Languages:

English en πŸ‡ΊπŸ‡Έ French fr πŸ‡«πŸ‡· Spanish es πŸ‡ͺπŸ‡Έ Urdu ur πŸ‡΅πŸ‡° Arabic ar πŸ‡ΈπŸ‡¦ Chinese zh πŸ‡¨πŸ‡³

Note: we are adding more languages and working on performance and enhancement

Made with ❀️ by Ahmed Khushal Khan

0
likes
150
points
267
downloads

Publisher

verified publisherlogicloomer.org

Weekly Downloads

A Flutter package for offline translation without any json or arb files.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_ml_kit, google_mlkit_translation, hive, path_provider, provider

More

Packages that depend on offline_translator