bugGNU gettext - Bugs: bug #58407, JavaScript parser stops at...


You are not allowed to post comments on this tracker with your current authentication level.

bug #58407: JavaScript parser stops at template literal inside JSX tag

Submitter:  whiteinge
Submitted:  Wed 20 May 2020 02:06:00 AM UTC
Category:  JavaScript Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Tue 08 Aug 2023 02:56:42 PM UTC, comment #1: 

I spent some time tearing my hair about this, but then discovered that somehow it's possible to use --language=C and it works on JSX perfectly.

Vladimír Slávik <vladimirslavik>
Wed 20 May 2020 02:06:00 AM UTC, original submission:  

Similar to bug #50920, the file parser stops when it encounters a JavaScript template literal inside of a JSX tag.

As a child of a tag:

const App = () => (

As an attribute inside a tag:

<div className={`${'foo'}`} />

Tested on 0.20.2.

Tested using: xgettext -o - template-literal-jsx-repro1.js

Expected output:

#: template-literal-jsx-repro1.js:3
msgid "one"
msgstr ""

#: template-literal-jsx-repro1.js:5
msgid "two"
msgstr ""

Actual output:

#: template-literal-jsx-repro1.js:3
msgid "one"
msgstr ""



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #49127:  template-literal-jsx-repro1.js added by whiteinge (84B - application/x-javascript)
file #49128:  template-literal-jsx-repro2.js added by whiteinge (51B - application/x-javascript)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by vladimirslavik (Posted a comment)
  • -email is unavailable- added by whiteinge (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-20 whiteinge Attached File- Added template-literal-jsx-repro1.js, #49127
        Attached File- Added template-literal-jsx-repro2.js, #49128

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code