CloudCannon / rosey

:rose: Open-source CLI tool for managing translations on static websites.
MIT License
41 stars 0 forks source link

[Bug] image src doesn't update #65

Open michael-proulx opened 1 month ago

michael-proulx commented 1 month ago

I added the following HTML code to implement image localization

<img alt="200k subscribers img" data-rosey-attrs-explicit='{"alt":"img-alt", "src": "img-src"}' src="https://cdnweb.devolutions.net/web/common/images/assets/mail-subscribers.png">

In the base.json, everything works fine, and I have added the corresponding translations to /locales/fr.json

{
  "pages/index:83f2d7bd-b09b-4b78-94c6-4da5d6add366:0d65b056-3e90-4d5f-a214-ce347f3aa38e:img-alt": {
    "original": "200k subscribers img",
    "value": "200k abonnés"
  },
  "pages/index:83f2d7bd-b09b-4b78-94c6-4da5d6add366:0d65b056-3e90-4d5f-a214-ce347f3aa38e:img-src": {
    "original": "https://cdnweb.devolutions.net/web/common/images/assets/mail-subscribers.png",
    "value": "https://cdnweb.devolutions.net/web/common/images/assets/mail-subscribers.fr.png"
  }
}

After running the npx rosey build command, the result is:

<img alt="200k abonnés" data-rosey-attrs-explicit='{"alt":"img-alt", "src": "img-src"}' src="https://cdnweb.devolutions.net/web/common/images/assets/mail-subscribers.png">

As you can see, the alt attribute is correctly translated, but the src attributte remains unchanged (it still points to the original image URL).

Do I need to take any additional steps for the image localization (img-src) to work correctly?

Thanks!