marhali / easy-i18n

This is a IntelliJ IDE based plugin for internationalization. Supports the most common translation file types.
MIT License
87 stars 27 forks source link

Escaped newline characters in arrays are getting lost #322

Open steffenabel opened 1 year ago

steffenabel commented 1 year ago

We have a part in our translation file like this:

"content": [
        {
          "headline": "We are a community, not a ground for hate or insults",
          "text": "Stay friendly and respectful. The Fryd community is a place for everyone who enjoys gardening. We support each other and enjoy growing our own vegetables.\nWe do not tolerate insults and hate comments in the community.\nHave tolerance for other opinions! A good exchange only happens when no one is afraid to share their opinion and experience."
        },
        {
          "headline": "Questions & Answers",
          "text": "There are no stupid questions, every question is welcome!"
        },
        {
          "headline": "Image use",
          "text": "You are responsible for your own images. We assume that you own the copyrights."
        },
        {
          "headline": "No place for advertising",
          "text": "It is important to us that Fryd is an ad-free space. Please do not post advertisements/links that are not related to a question or discussion."
        }
      ],

this is displayed in the easy i18n dialogue as the following string, which is fine, we can always edit it in the json directly.

!arr[\\{"headline":"We are a community, not a ground for hate or insults","text":"Stay friendly and respectful. The Fryd community is a place for everyone who enjoys gardening. We support each other and enjoy growing our own vegetables.\\nWe do not tolerate insults and hate comments in the community.\\nHave tolerance for other opinions! A good exchange only happens when no one is afraid to share their opinion and experience."};\\{"headline":"Questions & Answers","text":"There are no stupid questions, every question is welcome!"};\\{"headline":"Image use","text":"You are responsible for your own images. We assume that you own the copyrights."};\\{"headline":"No place for advertising","text":"It is important to us that Fryd is an ad-free space. Please do not post advertisements\/links that are not related to a question or discussion."}]

The problem is, that the newline characters are transformed from "\n" to "n" after editing any (unrelated) entry via the easy i18n input field.

Edit: I'm using Version 4.4.2 with phpstorm 2023.1.4