slang-i18n / slang

Type-safe i18n for Dart and Flutter
https://pub.dev/packages/slang
MIT License
419 stars 36 forks source link

Generated File "part of" import fix #187

Closed cmenkemeller closed 5 months ago

cmenkemeller commented 5 months ago

This is a bit of an edge case but the resolution should be good for overall generated file consistency.

Issue Replication

Run builder using the following configuration-

  1. output_file_name : localizations.t.dart (note: this is purposefully not set to a .g type file)
  2. output_format : multiple_files

Resulting files will contain error in "part of" section of imports due to a mismatch in file name. Generated file name fails to pull from the custom output_file_name parameter.

Resolution

Update "part of" code generation to use the config output_file_name instead of manually creating file name using baseName

Updates

  1. Added outputFileName as a parameter in GenerateConfig class
  2. Replaced "part of" import with outputFileName
  3. Updated tests to verify
Tienisto commented 5 months ago

Thank you!