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

"Extract to ARB file" assumes wrong base path in a monorepo #75

Open igoriuz opened 2 years ago

igoriuz commented 2 years ago

I have multiple flutter projects bundled together in a monorepo. To reuse localized strings i made a new sub package which is only dedicated for localization. Unfortunately i can't extract strings into the arb file. The plugin assumes that the base path is always the current opened project in android studio. But instead it should reuse the current working directory where it wants extracting the string from.

Here's a small example what it currently looks like:

.
├── .fvm
│   ├── flutter_sdk -> /Users/**/fvm/versions/2.8.0
│   └── fvm_config.json
├── apps
│   └── sample_app
├── l10n <----------------------- Plugin creates automatically a new directory
│   └── intl_de.arb
├── melos.yaml
└── packages
    ├── another_package
    ├── all_localization <------- This is the package where the plugin should search for arb-Files
    │   ├── assets
    │   ├── l10n <-- Here are my strings
    │   ├── lib
    │   ├── pubspec.lock
    │   └── pubspec.yaml
    └── another_package2

My pubspec.yaml from all_localization package looks as follows:

name: all_localization
description: A new Flutter package project.
version: 0.0.1
homepage:

environment:
  sdk: ">=2.15.0 <3.0.0"
  flutter: ">=1.17.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: ^0.17.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  intl_utils: ^2.4.0

flutter_intl:
  enabled: true
  class_name: S
  main_locale: de
  arb_dir: l10n
  output_dir: lib/src/localization/

My idea is only to create & extract strings from all_localization package.

I'm looking forward to your response. Thanks in advance. Great productivity tool you guys made here 👍

aleksakrstic commented 2 years ago

Seems related to https://github.com/localizely/flutter-intl-intellij/issues/22