Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow opting out of delegate generation #122

Open
denist11 opened this issue Jan 20, 2024 · 0 comments
Open

Allow opting out of delegate generation #122

denist11 opened this issue Jan 20, 2024 · 0 comments

Comments

@denist11
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant