localizely / intl_utils

Dart package that creates a binding between your translations from .arb files and your Flutter app
BSD 3-Clause "New" or "Revised" License
135 stars 81 forks source link

Provide a parameter that can support multi-arb folder. #95

Open dodatw opened 2 years ago

dodatw commented 2 years ago

I'm facing a classic problem that packages don't support international translations. Please refer to: https://github.com/localizely/flutter-intl-intellij/issues/22

I moved some common functionality into some packages, but it can't have its own translations. Only app projects have translations because "The application cannot load multiple delegate files because a CompositeMessageLookup has already been instantiated"

I found that if I copy the translation strings from the package to the main project it works. (because these translations are added when the application CompositeMessageLookup is initialized)

But I don't want copy manually everytime, I have an idea, is it possible to support multiple arb folders so that the main app can have all translation?

Something like:

flutter_intl:
  enabled: true
  other_arb_dirs: package/moduleA/l10n, package/moduleB/l10n