diff --git a/CHANGELOG.md b/CHANGELOG.md index 50101194..bae8cbcc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### [3.0.3] +- **BREAKING:** `EasyLocalization.assetLoader` is now `AssetLoader` (was dynamic). - replace log() with stdout.writeln() ### [3.0.2] diff --git a/lib/src/easy_localization_app.dart b/lib/src/easy_localization_app.dart index e5c9ec8c..9b6db7d3 100644 --- a/lib/src/easy_localization_app.dart +++ b/lib/src/easy_localization_app.dart @@ -65,8 +65,7 @@ class EasyLocalization extends StatefulWidget { /// Class loader for localization files. /// You can use custom loaders from [Easy Localization Loader](https://github.com/aissat/easy_localization_loader) or create your own class. /// @Default value `const RootBundleAssetLoader()` - // ignore: prefer_typing_uninitialized_variables - final assetLoader; + final AssetLoader assetLoader; /// Save locale in device storage. /// @Default value true @@ -195,9 +194,12 @@ class _EasyLocalizationProvider extends InheritedWidget { // _EasyLocalizationDelegate get delegate => parent.delegate; - _EasyLocalizationProvider(this.parent, this._localeState, - {Key? key, required this.delegate}) - : currentLocale = _localeState.locale, + _EasyLocalizationProvider( + this.parent, + this._localeState, { + Key? key, + required this.delegate, + }) : currentLocale = _localeState.locale, super(key: key, child: parent.child) { EasyLocalization.logger.debug('Init provider'); } @@ -245,8 +247,10 @@ class _EasyLocalizationDelegate extends LocalizationsDelegate { /// * use only the lang code to generate i18n file path like en.json or ar.json // final bool useOnlyLangCode; - _EasyLocalizationDelegate( - {this.localizationController, this.supportedLocales}) { + _EasyLocalizationDelegate({ + this.localizationController, + this.supportedLocales, + }) { EasyLocalization.logger.debug('Init Localization Delegate'); } @@ -260,9 +264,12 @@ class _EasyLocalizationDelegate extends LocalizationsDelegate { await localizationController!.loadTranslations(); } - Localization.load(value, - translations: localizationController!.translations, - fallbackTranslations: localizationController!.fallbackTranslations); + Localization.load( + value, + translations: localizationController!.translations, + fallbackTranslations: localizationController!.fallbackTranslations, + ); + return Future.value(Localization.instance); } diff --git a/lib/src/utils.dart b/lib/src/utils.dart index eedf0e2e..6e82ac7c 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -24,7 +24,7 @@ Locale localeFromString(String localeString) { } /// Convert [locale] to Srting with custom [separator] -@Deprecated('Deprecated on Easy Localization 3.0') +@Deprecated('Deprecated on Easy Localization 3.0, use Locale.toStringWithSeparator extension method.') String localeToString(Locale locale, {String separator = '_'}) { return locale.toString().split('_').join(separator); } diff --git a/pubspec.yaml b/pubspec.yaml index 08359f1b..858f4f90 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,9 +1,8 @@ name: easy_localization -description: Easy and Fast internationalizing and localization your Flutter Apps, this package simplify the internationalizing process . +description: Easy and fast internationalizing and localization your Flutter Apps, this package simplifies the internationalizing process. # author: AISSAT abdelwahab homepage: https://github.com/aissat/easy_localization issue_tracker: https://github.com/aissat/easy_localization/issues -# publish_to: none version: 3.0.3 @@ -11,18 +10,14 @@ environment: sdk: '>=2.12.0 <4.0.0' dependencies: - flutter: - sdk: flutter - shared_preferences: '>=2.0.0 <3.0.0' - intl: '>=0.17.0-0 <=0.18.1' args: ^2.3.1 - path: ^1.8.1 easy_logger: ^0.0.2 - flutter_localizations: - sdk: flutter - + flutter: { sdk: flutter } + flutter_localizations: { sdk: flutter } + intl: '>=0.17.0-0 <=0.18.1' + path: ^1.8.1 + shared_preferences: '>=2.0.0 <3.0.0' dev_dependencies: - flutter_test: - sdk: flutter flutter_lints: ^2.0.1 + flutter_test: { sdk: flutter }