kwado-tech / l10n_mapper

MIT License
4 stars 2 forks source link

No app-localizations.g.dart is generated #14

Closed vorlovsky closed 8 months ago

vorlovsky commented 8 months ago

After several attempts I'm still unable to make app-localizations.g.dart to be generated. I've provided a clear test project with only _flutterlocalization, intl, _l10n_mapperannotation and _l10n_mappergenerator added (basic AppLocalizationclass is generated, linked and works fine there): test_drive.zip

Notes: I've followed all the steps from your README, Mapper section.

All the _l10nmapper scripts run without any issues - and also without any result besides creation of app-localizations.dart.bak.

I was able to fix _scripts/annotatelocalization.dart by setting up a correct search string for annotations (line 39): String searchParameter = 'abstract class AppLocalizations {\n'; replaced with String searchParameter = 'abstract class AppLocalizations {'; This one enabled annotations to be actually applied upon dart pub run l10n_mapper_generator --gen-mapper.

Unfortunately, I'm not that experienced to figure out what's wrong with L10nMapperGenerator.generateForAnnotatedElement being called upon flutter pub run build_runner build. This command's output shows no errors, but app-localizations.g.dart does not appear.

Can you, please, check it and fix, or at least advice me how could I debug calls to L10nMapperGenerator.generateForAnnotatedElement during build? Do you need any more information from my side for it?

kwado-tech commented 8 months ago

Hi @vorlovsky I have been terribly busy and unavailable for some time but will take a look at your code within the week to understand the issues and resolve the resulting bug in the package

kwado-tech commented 8 months ago

Hey @vorlovsky finally found sometime to look into this and noticed the issues you indicated.

The issue with annotation was rightly pointed out and removing the line break worked as expected. However the generator failed because your project was setup to generate synthetic localization package in .dart_tool and changing this worked as expected as l10n-mapper does not support synthetic localization package.

Made a few changes to your setup

PS. Will publish fixes in a couple of hours and for ease of use, I'll suggest you utilize a script i.e example/scripts/generate_code

test_drive.zip