localizely / flutter-intl-intellij

This Android Studio & IntelliJ plugin generates boilerplate code for localization of Flutter apps with official Dart Intl library
MIT License
129 stars 4 forks source link

Add support for synthetic-package: false #121

Open andrewpmoore opened 1 month ago

andrewpmoore commented 1 month ago

I have a flutter components library package that uses intl.

It has a l10n.yaml file like this

synthetic-package: false
arb-dir: lib/l10n
template-arb-file: intl_en.arb
output-localization-file: app_localizations.dart
class_name: AppLocalizations

If the plugin isn't installed and I run flutter gen-l10n it generates the files in the correct directory e.g.

lib/l10n/
   app_localizations.dart
   app_localizations_en.dart
   intl_en.arb

and it doesn't create the generated directory, which it shouldn't for packages.

If I have the plugin installed, it creates the generated directory and the localizations then can't be picked up in the component package.

I love the extract to arb as it's such a time saver, but I can't use it when I'm trying to generate library packages.

lzoran commented 1 month ago

Hi @andrewpmoore ,

Thank you for your feedback! It's invaluable to us as it helps in understanding the needs and challenges that our users face.

Regarding the Flutter Intl and gen-l10n, it's important to note that these are two distinct approaches for generating the necessary localization code for Flutter apps utilizing the intl package. Mixing these two is not recommended since each generates its own unique set of localization code. At present, there isn't an option to utilize the 'Extract to ARB' feature independently of the code generation process.

andrewpmoore commented 1 month ago

Hi @lzoran Ideally, I don't want to have to run gen-l10n I'm only doing that because the package doesn't seem to handle synthetic-package: false

If it handled changing the generation location, then I'd be using it for my main projects and package projects. Sadly, I don't think there's a way to use it on one project and disable it on another with android studio.