flutter_localization_plus 0.0.1
flutter_localization_plus: ^0.0.1 copied to clipboard
Advanced localization with pluralization, gender-specific text, and RTL support
flutter_localization_plus #
Advanced localization with pluralization, gender-specific text, and RTL support for Flutter applications.
Features #
- ๐ Multi-language Support: Easy localization for multiple languages
- ๐ข Pluralization: Handle singular, plural, and other plural forms
- ๐ฅ Gender-specific Text: Support for masculine, feminine, and neutral text
- โก๏ธ RTL Support: Full right-to-left language support
- โก High Performance: Efficient text caching and management
- ๐ก๏ธ Type Safety: Type-safe localization keys and parameters
- ๐ฑ Flutter Integration: Seamless integration with Flutter apps
- ๐งช Well Tested: Comprehensive test coverage
Getting Started #
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_localization_plus: ^0.0.1
Basic Usage #
import 'package:flutter_localization_plus/flutter_localization_plus.dart';
// Initialize localization
final localization = FlutterLocalizationPlus(
locale: const Locale('en'),
fallbackLocale: const Locale('en'),
);
// Get localized text
final text = localization.translate('hello_world');
Pluralization Example #
// English: "1 item" vs "5 items"
final itemCount = localization.pluralize(
'item_count',
count: 5,
zero: 'No items',
one: '1 item',
other: '{{count}} items',
);
Gender-specific Text #
// Support for different genders
final greeting = localization.genderize(
'greeting',
gender: Gender.male,
male: 'Hello sir',
female: 'Hello madam',
neutral: 'Hello',
);
API Reference #
FlutterLocalizationPlus #
The main class for handling localization.
Constructor
FlutterLocalizationPlus({
required Locale locale,
Locale? fallbackLocale,
Map<String, Map<String, String>>? translations,
})
Methods
translate(String key, {Map<String, dynamic>? args}): Translate a key to the current localepluralize(String key, {required int count, String? zero, String? one, String? other}): Handle pluralizationgenderize(String key, {required Gender gender, String? male, String? female, String? neutral}): Handle gender-specific textsetLocale(Locale locale): Change the current localeisRTL(): Check if current locale is RTL
Supported Locales #
The package supports all locales supported by Flutter, including:
- English (en)
- Arabic (ar) - with RTL support
- French (fr)
- German (de)
- Spanish (es)
- And many more...
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Author #
Dhia Bechattaoui
- GitHub: @Dhia-Bechattaoui
Support #
If you encounter any problems or have suggestions, please file an issue at the GitHub repository.