flutter_locale_master 1.0.2
flutter_locale_master: ^1.0.2 copied to clipboard
Advanced Flutter localization with automatic RTL/LTR switching, reactive UI updates, asset-based translations, pluralization, and custom widgets.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.0.2 - 2025-09-22 #
Fixed #
- Package Description: Shortened description to meet pub.dev requirements (60-180 characters)
- Deprecated API Usage: Replaced deprecated
ui.window.localeswithWidgetsBinding.instance.platformDispatcher.locales - Static Analysis: Fixed lint warnings for deprecated member usage
- Pub Points: Improved package score from 140 to target 160 points
Technical Details #
- Updated locale detection to use modern Flutter APIs
- Improved package metadata for better pub.dev presentation
- Maintained backward compatibility while fixing deprecation warnings
Fixed #
- Supported Locales Parameter: Fixed
supportedLocalesparameter ininitialize()method to properly configure allowed locales - Localization Delegate: Fixed
FlutterLocaleMasterDelegate.isSupported()to use configured supported locales instead of auto-detected ones - Locale Validation: Resolved warnings about unsupported locales in MaterialApp integration
- Example App: Updated example app to properly use supported locales configuration
Technical Details #
- Delegate now respects the
supportedLocalesparameter passed toinitialize() - Fixed locale validation warnings when using Arabic and other RTL locales
- Improved integration with Flutter's localization system
Added #
- Multi-file Translation Support: Organize translations with multiple JSON files per locale
- Namespace-based Organization: Automatic namespace detection from file names
- Locale-specific General Files: Use locale code as filename for default namespace (e.g.,
en.json,ar.json) - Field Translation Support: Dedicated
fields.jsonfiles with.field()extension method - Validation Message Support: Dedicated
validation.jsonfiles for form validation - Automatic Text Direction Switching: Framework-level RTL/LTR handling based on locale
- Asset-based Translation Loading: Load translations from Flutter assets with preloading
- Reactive Locale Management: LocaleController with ChangeNotifier for automatic UI updates
- Custom Widgets: TranslatedText, TranslatedRichText, LocaleConsumer, LocalizationProvider
- BuildContext Extensions: Convenient translation methods (tr, plural, field, isRTL, locale)
- String Extensions: Context-free translation access using FlutterLocaleMaster.instance
- Pluralization Support: Built-in plural forms with count parameter and ICU MessageFormat
- Parameter Replacement: Dynamic text substitution with named placeholders
- Flutter Integration: Custom LocalizationsDelegate for MaterialApp integration
- Service Layer Architecture: Modular design with interfaces for all core services
- Translation Caching: In-memory caching with concurrent loading for optimal performance
- Comprehensive Testing: Unit and widget tests for all major components (28 tests)
- Example Application: Complete demo with English, French, and Arabic support
Technical Details #
- Dependencies:
flutter_localizations(Flutter SDK) - Flutter SDK: >=1.17.0
- Dart SDK: >=3.8.1
- Platform Support: iOS, Android, Web, Desktop
- Architecture: Clean architecture with services, providers, controllers, widgets, and extensions
- File Structure:
lang/{locale}/{namespace}.json(e.g.,lang/en/en.json,lang/en/fields.json) - Namespace Support: Automatic namespace resolution from filename
- RTL Languages: Full support for Arabic, Hebrew, Persian, Urdu, and other RTL scripts
0.0.1 - 2025-01-21 #
- Initial release with basic localization functionality.