Why Flutter intl plugin keeps generating wrong files even if proper template provided?

355 Views Asked by At

Followed the tutorial from Internationalizing Flutter apps only to discover that once Android Studio (Giraffe|2022.3.1 Patch1)'s Flutter Int plugin was initialized it will keep generating same file intl_en.arb inside the l10n folder even if the l10n.yaml file had a different template.

The l10n folder ends up looking like this (note the unwanted intl_en.arb file):

enter image description here

l10.yaml's content is:

arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart

The only solution I found was to go to pubspec.yaml file and disable flutter_intl option like this:

flutter_intl:
  enabled: false

but after this I have to regenerate the translation, every time I do a change in .arb file with next command:

flutter gen-l10n

For now it's kinda ok but I wonder where the problem comes from?

1

There are 1 best solutions below

0
Moritz Lahme On

I could solve this problem by deactivating flutter_intl in the pubspec.yaml

flutter_intl:
    enabled: false

Then rename all of my arb files to intl_en.arb and in l10n.yaml set the name of the template file to intl_en.arb.

template-arb-file: intl_en.arb

Lastly reactivate flutter_intl again

flutter_intl:
    enabled: true