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

How to use a custom intl_utils source #112

Closed evanwsu closed 11 months ago

evanwsu commented 1 year ago

I want to use a custom intl_utils source, what do I do? When enabled is true, run pub get, which downloads intl_utils from pub.dev to override the locally activated intl_utils.

flutter_intl:
enabled: true
lzoran commented 1 year ago

As far as I remember, the Flutter Intl plugin does not support the use of a custom source for the intl_utils package. However, you could consider adding a custom source as a dev dependency to your project. After that, you can invoke it manually or integrate it with a build runner to automate the process (I haven't checked this approach). This method may serve as a workaround for your use case.

The pubspec.yaml file:

dev_dependencies:
  flutter_test:
    sdk: flutter
  intl_utils:
    git:
      url: https://github.com/localizely/intl_utils # Your source

flutter_intl:
  enabled: false # Disable Flutter Intl to prevent overwriting

Manually generate localization code:

dart run intl_utils:generate
evanwsu commented 1 year ago

After each arb file is edited, the dart instruction is not automated, and I like the Intl plugin's save-as-build feature.

Maybe I need to write my own IntelliJ IDEA plugin, but I have no experience. If the Flutter Intl plugin supports configurable intl_utils, it will pub global activate --source custom_intl_utils is great.

evanwsu commented 11 months ago

I have resolved the issue by using an external tool along with a shortcut key.