mololab / json-translator

jsontt 💡 - FREE simple CLI to translate your json files into other languages ✅ Check Readme ✌

Home Page:https://mololab.org/jsontt/npm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignore urls in translation

multipliedtwice opened this issue · comments

Hello, I'm trying to translate an object where the value is HTML generated by Tiptap editor.
It works more or less well when I have regular text. Problems start when I am trying to add an image - the script translates the image URL.

How can I ignore all URLs? Maybe regex or smth like this?

This is the data to translate:

<p>- Guarantee the product as in the real picture.</p>
<p>- All products are the same as in the pictures.</p>
<p>- Guarantee that you won't be disappointed</p>
<p>- The product is made of good quality materials, meticulously sewn.</p>
<p>- Flexible, balanced with our feet.</p>
<p>- Products manufactured according to international standards, using grade A materials, are durable, and not easily broken</p><p>- Goes with every outfit, every occasion.</p>
<p>
<img src="http://localhost:1337/uploads/LW_Screen_Shot_2564_04_02_at_18_29_07_cf950666d4.png?format=webp&amp;q=40">
<img src="http://localhost:1337/uploads/1_y_M_Qvo3_Hyb_Is9_Vv_I_Fwc_Gp7w_9382dccccc.png?format=webp&amp;q=40">
<br>
</p>

The output returns broken img tag

Hi @thousandsofraccoons ,

The main focus of the package was to translate the JSON files/objects which contain just words (or sentences) instead of HTML. But that would be a wonderful feature for the package to also support HTML translations.

Thank you for the feedback. I will try to add this feature asap. For a temporary solution, you can wrap the things that you don't want to translate with "{{don`t translate here}}".

For example, convert it

from this:

{
    "data": "here is the url https://www.google.com"
}

to that:

{
    "data": "here is the url {{https://www.google.com}}"
}

@ParvinEyvazov thank you very much, would be amazing to see such an update. Great library!

Hey @multipliedtwice

jsontt now ignores URLs on translation after the v1.5.0 version. ✔️