slang-i18n / slang

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

Running slang apply duplicates map #209

Closed bawahakim closed 2 months ago

bawahakim commented 3 months ago

Describe the bug Running slang apply duplicates map obkects into a non-mapped version

To Reproduce Steps to reproduce the behavior:

  1. Create en-US and fr-FR files
  2. Add a map to en-US
  3. Run dart run slang analyze followed by dart run slang apply
  4. Observed behaviour below (see // fr-FR
// en-US
    "couponValidations(map)": {
      "CouponNotExist": "There is no box with this code",
      "CouponAlreadyUsed": "You have already claimed this box",
      "CouponLimitReached": "Too late! This box has no more claims available",
      "CouponExpired": "Too late! This box has expired"
    },
// fr-FR
    "couponValidations(map)": { <-- this gets added as expected
      "CouponNotExist": "There is no box with this code",
      "CouponAlreadyUsed": "You have already claimed this box",
      "CouponLimitReached": "Too late! This box has no more claims available",
      "CouponExpired": "Too late! This box has expired"
    },
    "couponValidations": { <-- This object gets added after running `slang apply`
      "CouponNotExist": "There is no box with this code",
      "CouponAlreadyUsed": "You have already claimed this box",
      "CouponLimitReached": "Too late! This box has no more claims available",
      "CouponExpired": "Too late! This box has expired"
    }

Expected behavior The object should not be duplicated

Additional context This seems to only happen with (map). Also, the duplicate does not exist in _missing_translations.json

Tienisto commented 3 months ago

What version do you use? This should be fixed in 3.30.1 recently

bawahakim commented 2 months ago

I am on 3.29.0, will try out 3.30.1. Will update, thank you!