i18next / ng-i18next

translation for AngularJS using i18next
https://github.com/i18next/ng-i18next
MIT License
161 stars 54 forks source link

HTML tags are not sanitized properly when passed as an option #133

Closed chris-miaskowski closed 6 years ago

chris-miaskowski commented 7 years ago

Hi, I wanted to say the library is great and it helps me a lot with localising the app I'm working on. I have, however, stumbled across a problem I can't find a workaround for. I'm working on a project that's using Angular 1.2.8 and trying to translate this string:

<h3 ng-i18next="[html:i18next]({ small_start: '<small>', small_end: '</small>' })some-key"></h3>

where:

"some-key": "text outside {{small_start}}small text?{{small_end}}"

renders on the page as (literally):

text outside <small></small>small text?

I would greatly appreciate any help from your end.

miluoshi commented 7 years ago

You forgot to unescape your placeholders in the translation string, like this: "some-key": "text outside {{- small_start}}small text?{{- small_end}}"