X Tutup
The Wayback Machine - https://web.archive.org/web/20201124195520/https://github.com/wp-cli/i18n-command/issues/218
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make-pot: add support for JavaScript optional chaining operator #218

Open
mloetsch opened this issue Jun 22, 2020 · 1 comment
Open

make-pot: add support for JavaScript optional chaining operator #218

mloetsch opened this issue Jun 22, 2020 · 1 comment

Comments

@mloetsch
Copy link

@mloetsch mloetsch commented Jun 22, 2020

Bug Report

current behavior

the make-pot command seems to ignore javascript files using the optional chaining operator somewhere in the code completely.

reproduction

use the optional chaining operator in javascript files using the wp.i18n module like:

const {__} = wp.i18n;
..
..

const someReactComponent = () => (
 <>
   <a href={selectedPost?.link}>__('my translatable string')</a>
 </>
);
..
..

then use wp cli to generate a .pot file:

wp-cli wp i18n make-pot <plugin_dir> ./languages/.pot

expected outcome

the wp-cli i18n make-pot command includes javascript files using the optional chaining operator and successfully extracts the translation strings

@mloetsch mloetsch changed the title make-pot: add support for JavaSCript optional chaining operator make-pot: add support for JavaScript optional chaining operator Jun 22, 2020
@swissspidy
Copy link
Member

@swissspidy swissspidy commented Jun 24, 2020

Great timing, our upstream library that implements JS parsing just introduced support for this 3 days ago: https://github.com/mck89/peast/releases/tag/v1.10.4

Fixing this should be as easy as a version bump in composer.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.
X Tutup