question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 : 01 ember-intl-ok


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 : 02 ember-intl-not ok

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 : 03 ember-intl-not ok

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 : 04 ember-intl-ok

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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
catzcommented, Sep 16, 2020

I checked version 5.5.0 and so far so good! No changes required.

1reaction
jasonmitcommented, Aug 18, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML 5.1 2nd Edition: 10. Rendering - W3C
The presence of the hidden attribute normally means the element is not being rendered, though this might be overridden by the style sheets....
Read more >
Unreal Engine 5.1 Release Notes
Attribute binding: The widget defers the value of one of its fields (such as a text field) to a Property or a Blueprint...
Read more >
Changelog | 2D Animation | 5.1.1 - Unity - Manual
Sprite outline in the Skinning Editor is now rendered based on Sprite's geometry. · Fixed render texture size error in the Skinning Editor....
Read more >
Living Standard - HTML Spec
1 Introduction · 2 Common infrastructure · 3 Semantics, structure, and APIs of HTML documents · 4 The elements of HTML · 5...
Read more >
Motion release notes - Apple Support
Before installing a Motion update, verify that your system still meets ... Fixes an issue where the Refraction filter might not render ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found