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:  Fix Released
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Sun 01 Dec 2024 04:33:39 PM UTC, comment #3: 

The fix is contained in gettext 0.23.

Bruno Haible <haible>
Group administrator
Thu 26 Sep 2024 11:13:05 PM UTC, comment #2: 
Bruno Haible <haible>
Group administrator
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 = () => (
  <div>
    _('one');
    {`${'foo'}`}
    _('two');
  </div>
)


As an attribute inside a tag:


_('one');
<div className={`${'foo'}`} />
_('two');


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 ""


whiteinge

 

(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 haible (Posted a comment)
  • -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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-12-01 haible StatusFixed Fix Released
    2024-09-26 haible Assigned toNone haible
        Open/ClosedOpen Closed
    2024-09-26 haible StatusNone Fixed
    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.15.
    Corresponding source code