Upgrade to 5.1.1 - Issue when rendering tags with attributes
See original GitHub issue- I am on the latest ember-intl version
- I have searched the issues of this repo and believe that this is not a duplicate
Environment
- Ember Version: 3.12
- Ember CLI Version: 3.12
- Ember Intl Version: 5.1.1
- Browser(s): Chromium Version 81.0.4044.129
- Node Version: 12.16.3
Steps to Reproduce
My issue seems to be related to #1336 but the problem is not exactly the same, also I tried the provided solution and it didn’t work in my case.
I am currently upgrading ember-intl
from 4.2.3
to 5.1.1
and your new HTML escaping seems buggy and/or badly documented.
Before the upgrade, this was working perfectly :
-- HBS file
{{t "general.forms.required_fields" htmlSafe=true}}
-- YAML file
general:
forms:
required_fields: Fields marked <strong class="primary">*</strong> are required.
Render :
According to your your upgrade guide we now need to escape HTML tags, fine, let’s do it the recommended way (also here):
-- HBS file
{{t "general.forms.required_fields" htmlSafe=true}}
-- YAML file
general:
forms:
required_fields: Fields marked '<strong class="primary">'*'</strong>' are required.
Render :
Hum… ?
Let’s try again without involving too many quotes:
-- HBS file
{{t "general.forms.required_fields" htmlSafe=true}}
-- YAML file
general:
forms:
required_fields: Fields marked '<strong>'*'</strong>' are required.
Render :
So I still have the same issue.
Let’s try again :
-- HBS file
{{t "general.forms.required_fields" htmlSafe=true}}
-- YAML file
general:
forms:
required_fields: 'Fields marked <strong>*</strong> are required.'
Render :
It seems okay, but I want my class.
New attempt:
-- HBS file
{{t "general.forms.required_fields" htmlSafe=true}}
-- YAML file
general:
forms:
required_fields: 'Fields marked <strong class="primary">*</strong> are required.'
Render :
An error occurred (Expected "#", "'", "\n", "{", argumentElement, double apostrophes, end of input, or tagElement but "<" found.) when extracting ICU arguments for 'Fields marked <strong class="primary">*</strong> are required.'
I get the same error if I try to espace the quotes :
required_fields: 'Fields marked <strong class=\"primary\">*</strong> are required.'
What am I doing wrong ? Am I missing something ? (I tried the same thing as #1336) How do you expect us to use this new escaping ?
Thank you for your help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
I checked version 5.5.0 and so far so good! No changes required.
Just a heads up, soon the new translation escaping behavior in 5.x will no longer be necessary.
The v4 behavior will be restored in a backwards compatible way. For those that have already went through the process of escaping everything, you will not have to revert back - both formats will continue to be supported.
https://github.com/ember-intl/ember-intl/pull/1420