You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr: The following breaks string-extraction: <p translate>{{ n <= 1 ? 'a' : 'b' }}</p>
When I did a quick scan through already-filed issues I couldn't find any similar to this – sorry if I missed it and this is a duplicate.
Steps to reproduction
In an html-element with a translate-attribute, use a smaller-than-or-equal-to operator (<=) in a data-bounds ({{ }}) expression.
Run the nggettext_extract grunt-task
Expected:
Only the inner contents of the html-element should be extracted by the grunt-task. ({{ n <= 1 ? 'a' : 'b' }})
Actual:
Everything after the opening tag of the html-element is extracted (the extracted string might look something like {{ n <= 1 ? 'a' : 'b' }}</p></div></section>)
Tests/code
The following will break on the 4th <p>:
<!-- test/fixtures/shorthand_if.html --><html><body><ptranslate>1 start {{ n > 1 ? 'if' : 'else' }} end</p><!-- comment after 1st line --><span>after first</span><ptranslate>2 start {{ n >= 1 ? 'if' : 'else' }} end</p><!-- comment after 2nd line --><span>after second</span><ptranslate>3 start {{ n <1? 'if' : 'else' }} end</p><!-- comment after 3rd line --><span>after third</span><ptranslate>4 start {{ n <= 1 ? 'if' : 'else' }} end</p><!-- comment after 4th line --><span>after fourth</span></body></html>
tl;dr: The following breaks string-extraction:
<p translate>{{ n <= 1 ? 'a' : 'b' }}</p>
When I did a quick scan through already-filed issues I couldn't find any similar to this – sorry if I missed it and this is a duplicate.
Steps to reproduction
translate
-attribute, use a smaller-than-or-equal-to operator (<=
) in a data-bounds ({{ }}
) expression.nggettext_extract
grunt-taskExpected:
{{ n <= 1 ? 'a' : 'b' }}
)Actual:
{{ n <= 1 ? 'a' : 'b' }}</p></div></section>
)Tests/code
The following will break on the 4th
<p>
:Result/output
Workaround
Use a greater-than operator (
>
) and swap your ‘if’ and ‘else’ values.The text was updated successfully, but these errors were encountered: