Flutter Intl plugin – how to set location of l10n directory that is generated?

1.5k Views Asked by At

I'm trying to use the flutter_intl plugin for Android Studio with an add-to-app Flutter app I'm developing on Android (by which I mean the Flutter app exists within an Android app, in its own sub-directory, and the Android Studio project includes all the Android code as well.) The issue is when I initialise flutter_intl it creates the l10n folder at the base of the Android directory, not further down the tree where Flutter's lib folder actually is. Is it possible to specify in flutter_intl where the l10n folder should be, rather than it being automatically generated within a new lib folder at the root?

1

There are 1 best solutions below

1
Alaindeseine On

Just create an l10n.yaml file at the root directory and put this in the file:

arb-dir: lib/l10n
output-dir: l10n

Change the directory according to your needs.

change arb-dir for translations files directory and output-dir for output files.

Run flutter gen-l10n --help command, parameters listed can be used in l10n.yaml file

see also: https://stackoverflow.com/a/71401194/8807231