flutter_pipwave_localization 0.0.3+2
flutter_pipwave_localization: ^0.0.3+2 copied to clipboard
Powerful and flexible localization package for Pipwave Flutter projects, featuring ICU message formatting, runtime locale switching, asset and dynamic translation file support.
Changelog #
0.0.3+2 2026-2-11 #
Enhancement #
- Update BCP-47 locale tags to use proper casing for
zh-CNin documentation and code comments
0.0.2 2026-1-28 #
Enhancement #
- Support BCP-47 language code and rebuild layout after download assets
0.0.1+3 2026-1-16 #
Enhancement #
- Add plural/gender detection and support positional/named args in translations.
- Implement plural and gender leaf node detection in key extraction.
- Mixture handling on named and unamed param.
- Validation on ICU formatting with better argument handling and fallback logic.
0.0.1+2 2025-11-3 #
Documentation #
- Updated README to document ICU message format plural support (
"{count, plural, =0{message0} =1{message1} =2{message2} few{messageFew} many{messageMany} other{messageOther}}")
Enhancement #
- Added code generation command documentation with default arguments
- Clarified support for both object-based and ICU message format plurals
0.0.1+1 - 2025-10-21 #
0.0.1 - 2024-12-21 #
Added #
-
Initial release of PW Localization Flutter package
-
Core Features:
- EasyLocalization-compatible API for seamless migration
- Full ICU message formatting support (plurals, gender, select)
- Dynamic language file downloading from remote servers
- Asset-based fallback for offline scenarios
- Runtime locale switching capabilities
- Type-safe translation key generation
-
Widgets & Components:
LocalizationProvider- Main widget for app-wide localizationLocalizedMaterialApp- Convenience widget combining MaterialApp with localizationCustomLocalizationDelegate- Flutter localization system integration
-
Services:
LocalizationService- Core service for translation management- ICU message formatting with
intlpackage integration - Automatic fallback to asset files when downloads fail
-
Extensions:
BuildContextextension for easy translation access (context.tr())Stringextension for direct translation ('key'.tr())- Convenient argument passing with
trArgs()
-
Code Generation:
- Translation key generator script (
bin/generate.dart) - Automatic
LocaleKeysclass generation from JSON files - Type-safe translation key constants
- Translation key generator script (
-
Advanced Features:
- Nested translation key support (e.g.,
welcome.title) - Plural rule handling (zero, one, many, other)
- Gender-based translations
- Complex ICU message patterns
- Translation caching and memory management
- Download progress tracking and error recovery
- Nested translation key support (e.g.,
Technical Details #
- Dependencies: Flutter 3.8.0+, Dart 3.9.0+
- Key Packages:
intl,dio,path_provider,flutter_localizations - Architecture: Singleton service pattern with widget integration
- Storage: Asset-based with optional downloaded file caching
- Error Handling: Comprehensive exception handling with graceful fallbacks
Migration Guide #
This package is designed as a drop-in replacement for EasyLocalization:
- Replace
EasyLocalizationwidget withLocalizationProvider - Update import statements to use
flutter_pipwave_localization - Translation access patterns remain the same (
context.tr()) - Asset structure can remain unchanged
- Optional: Use code generation for type-safe keys
Breaking Changes #
- None in initial release (designed for seamless migration)
Known Issues #
- ICU message formatting may have edge cases with complex nested structures
- Large translation files may impact initial load time
- Network-dependent features require proper error handling