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

Optional chaining support #112

Open
Rovniy opened this issue Jun 9, 2020 · 2 comments
Open

Optional chaining support #112

Rovniy opened this issue Jun 9, 2020 · 2 comments

Comments

@Rovniy
Copy link

Rovniy commented Jun 9, 2020

I have problem with extracting translates from *.vue files, wich use ES8 feature object-chaining.
As sample: const a = object?.someKey?.someValue provide to reject Make script with error: Trace: SyntaxError: Unexpected token. If i remove chaining, all scripts successfully done. How resolve this problem?

@kemar
Copy link
Contributor

kemar commented Jul 8, 2020

Please , feel free to submit a PR @kristofferdamborg 😄

@Knogobert
Copy link

This is possible thanks to Polyconseil/easygettext#72, it enables you to use Babel as a parser instead of Acorn (which doesn't support optional chaining atm). Just make sure your babel parser correctly has the optional-chaining-plugin installed and then add the --parser=babel argument to the gettext-extract command that you probably are using.
Here's a part of an example from my project's code:

# Extract gettext strings from templates files and create a POT dictionary template.
gettext-extract --attribute=v-translate --parser=babel --quiet --output $TEMPDIR/template.pot $GETTEXT_HTML_SOURCES

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants