# HTML code gets corrupted in language translation files

**URL:** <https://discourse.slicer.org/t/html-code-gets-corrupted-in-language-translation-files/26187>\
**Category:** Development\
**Tags:** internationalization\
**Created:** [July 28, 2022, 11:51am UTC](https://discourse.slicer.org/t/html-code-gets-corrupted-in-language-translation-files/26187 "2022-07-28T11:51:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aki](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aki/32/10110_2.png) [@Aki](https://discourse.slicer.org/u/Aki)\
**Post date:** [July 28, 2022, 11:51am UTC](https://discourse.slicer.org/t/html-code-gets-corrupted-in-language-translation-files/26187/1 "2022-07-28T11:51:33Z")

</div>

hello, lassoan,

I have completed the translation of the strings for Japanese.  
But, I found that some HTML tags disappear after saving the translation.  
Some strings including HTML tags, and the tags and parameter values in tags disappear, in particular,

```auto
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">

```

is changed to

```auto

&lt;html&gt;<meta name="qrichtext" content="1"><style type="text/css">

```

Also, some style strings are changed, like

```auto
</span><span style=" font-size:8pt; font-weight:600;">

```

to

```auto
</span><span style="">

```

If you have a solution for this, please let me know.  
Thanks.

---

<div class="post-metadata">

**Author:** ![DDinghoya](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ddinghoya/32/16545_2.png) [@DDinghoya](https://discourse.slicer.org/u/DDinghoya)\
**Post date:** [September 7, 2022, 2:30am UTC](https://discourse.slicer.org/t/html-code-gets-corrupted-in-language-translation-files/26187/2 "2022-09-07T02:30:24Z")

</div>

I agree. The same is true for Korean.

In my opinion, it seems to occur only for characters using a 2-byte character set.

Also, in the case of Korean, 100% translation was performed on Weblate, but translation was not applied in some surrenders.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 10, 2022, 6:27pm UTC](https://discourse.slicer.org/t/html-code-gets-corrupted-in-language-translation-files/26187/3 "2022-11-10T18:27:21Z")

</div>

We enabled in Weblate to have HTML code in translation files, so text corruption should not occur anymore. The existing messages should be fixed up as explained in [HTML tags and special characters get corrupted · Issue #14 · Slicer/SlicerLanguagePacks · GitHub](https://github.com/Slicer/SlicerLanguagePacks/issues/14).

Going forward, we’ll try to avoid using HTML formatting in translatable text, by adding formatting outside the translatable strings wherever it is possible.

---

<div class="post-metadata">

**Author:** ![Aki](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/aki/32/10110_2.png) [@Aki](https://discourse.slicer.org/u/Aki)\
**Post date:** [November 15, 2022, 9:46am UTC](https://discourse.slicer.org/t/html-code-gets-corrupted-in-language-translation-files/26187/4 "2022-11-15T09:46:53Z")

</div>

Thanks, Lassoan

I checked the Japanese translation on Weblate. I have done the replacement of the \< \> and so on to the original charactors and copying the html tags which are included in the origianl English strings to the translated strings.

Aki
