localize_and_translate
6.0.8, released 2 years ago by msayed.net
Flutter localization library to manage translations from local assets or remote networks.
What it does
It loads and manages app translation files from local JSON assets or network URLs. It provides context extensions to easily change locales, fetch current language codes, and translate keys using `.tr()`.
AI-written summary of version 6.0.8, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to load localization files from local assets or remote servers dynamically.
- You prefer a localization approach without code generation steps.
Skip it when
- You need robust compile-time safety for translation keys via code generation.
- You rely on complex intl pluralization rules that require specific ICU message formats.
Strengths
- Supports loading translation files over the network in addition to local assets.
- Simple context extensions for retrieving and updating locales.
- Built-in caching support using Hive.
Weaknesses
- Does not use the standard `intl` package.
- Documentation can be sparse for advanced pluralization features.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Requires adding translation asset folders to pubspec.yaml, initializing LocalizeAndTranslate in main, and adding supported locales to iOS Info.plist.
await LocalizeAndTranslate.init(
assetLoader: const AssetLoaderRootBundleJson('assets/lang/'),
supportedLanguageCodes: <String>['ar', 'en'],
);
runApp(LocalizedApp(child: MaterialApp(home: MyHomePage())));Alternatives
Packages that do the same job and could replace localize_and_translate.
- easy_localization
It is a widely-used alternative for managing localized assets with easy context extensions.
64Compare - slang
If you prefer type-safe translations generated at compile time.
90Compare
Works with
Packages commonly used together with localize_and_translate: ones it builds on, ones built on it, and its own family.
- diolocalize_and_translate depends on itA powerful HTTP networking package for Dart and Flutter with interceptors and request cancellation.
- hivelocalize_and_translate depends on itFast, pure Dart key-value store with optional AES-256 encryption
- hive_flutterlocalize_and_translate depends on itFlutter extension for Hive providing easy initialization and adapters for common types.