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.
Related Issues
Many users of this package may want to create their own
LocalizationDelegate<T>implementation and provide their own localized resourceT.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.yamlsuch as: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_translationdirectly:$ dart run intl_translation:generate_from_arb \ --output-dir=path/to/intl \ path/to/app_localizations.dart \ path/to/arb/intl_*.arbI don't have time to work on a PR and the solution I found seems convenient enough to abandon
intl_utilsfor 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.Related Issues