Allow opting out of delegate generation
Opened this issue · 0 comments
Many users of this package may want to create their own LocalizationDelegate<T>
implementation and provide their own localized resource T
.
The reason for this, I have noticed, is often related to the way the delegate is initialized, not allowing more than one delegate to be used at a time.
However, this is often necessary, for example when a package wants to take advantage of the convenience of using this generator to provide its localizations.
One possible solution would be to add a configuration in the pubspec.yaml
such as:
flutter_intl:
enabled: true
skip_delegate: true # Optional
And avoid generating l10n.dart when this option is enabled. This way the user can build his own initialization mechanism according to their needs.
I currently removed all dependencies to this generator, and opted to use intl_translation
directly:
$ dart run intl_translation:generate_from_arb \
--output-dir=path/to/intl \
path/to/app_localizations.dart \
path/to/arb/intl_*.arb
I don't have time to work on a PR and the solution I found seems convenient enough to abandon intl_utils
for my use case. I hope though that in the future this request will be taken into consideration and someone will decide to work on it.