Closed sed1ka closed 2 weeks ago
Hello, you can call LocaleSettings.setPluralResolver
anywhere before accessing a translation. For example, I am initializing it before creating the MaterialApp
.
For example
void main() {
WidgetsFlutterBinding.ensureInitialized();
LocaleSettings.setPluralResolver(...); // before any translation access is good enough
LocaleSettings.useDeviceLocale();
runApp(TranslationProvider(
child: MyApp(),
));
}
Thanks for the quick response.
But after looking deeply, I think it's fine to ignore the exception at least the _defaultResolver
on plural_resolver_map.dart is enough for my case.
Thanks for great localizations library
I got an exception message
Resolver for <lang = id> not specified! Please configure it via LocaleSettings.setPluralResolver. A fallback is used now.
The explanation in #167 is not clear enough for me.
So where and when should I use setPluralResolver?
Currently, I only used
t.<localtizationsKey>
directlyand with
final t = AppLocalizations.of(context);
inbuild
method,Based on #167, do you mean I need to always call
setPluralResolver
after using any LocaleSettings? Example like:Or can I ignore the exception warning? because
_defaultResolver
on plural_resolver_map.dart was enough for me.If my assumptions are wrong, please tell me correctly when and where I should use setPluralResolver. Please provide examples to be very helpful. Thanks