aurelia / i18n

A plugin that provides i18n support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTML entities in translations properties

hadrienl opened this issue · comments

I'm submitting a bug report

  • Library Version:
    1.6.2

Please tell us about your environment:

  • Operating System:
    OSX 10.13.1

  • Node Version:
    8.1.4

  • NPM Version:
    5.4.0

  • JSPM OR Webpack AND Version
    aurelia-cli 0.26.1 (requirejs)

  • Browser:
    Chrome 62

  • Language:
    ESNext

Current behavior:
I have a string in a const : const text = 'A&B';. I give this property as variable of a translation:

<p
  t="my.key"
  t-params.bind="{ text: text }"></p>

Wirth the current translation : "Hello {{text}}", my browser displays : "Hello A&B".

Expected/desired behavior:
My browser should display "Hello A&B" in the same way as I just display my prop with ${text}.

Im not sure I get the expected and actual result. Could it be that Github changes the amp sign for one of them?

Ok I figured it out by trying to edit your issue. So what you're saying is that the current result is the escaped variant A&ampB instead of A&B. Well thats totally fine, since you're using the text interpolation by default. If you'd like everything to be properly displayed your t binding should look like this:

t="[html]my.key"

Keep in mind though that this could be a potential security issue, depending on what your bound t-params value is. So it would make sense to properly check potential inputs.