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

Trace: TypeError: expression.arguments is not iterable when import $gettext... is used #37

Closed
escapedcat opened this issue Jul 3, 2018 · 2 comments
Assignees
Labels

Comments

@escapedcat
Copy link

In our component files we use a helper like this:

<script>
import $gettext from '@helper/gettext'

export default {
  ...
}
</script>

With 2.5.0 (#34) I get:

Trace: TypeError: expression.arguments is not iterable

Looks like it's trying to parse the import statement.

@gorkat gorkat added the bug label Jul 3, 2018
@gorkat gorkat self-assigned this Jul 3, 2018
gorkat added a commit to gorkat/easygettext that referenced this issue Jul 3, 2018
…ext function

This commit is a fix for issue Polyconseil#37. The problem came from the extractor
that was trying to extract the strings arguments of any gettext-like
node without making sure that the type of the current node was a CallExpression.
This fix prevents the extractor to automatically extract strings or variables
or whatever called like a vue-gettext function.

How to test:
- setup a vue file containing decoys looking like some gettext functions
  like:

<template>
  <h1>{{ message }}<h1>
</template>
<script>
import $gettext from '@helper/gettext';

export default {
  name: "$gettext", // because some people are actually weird
  computed: {
    message() {
      return this.$gettext('Hello world from the $gettext function');
    }
  }
}
</script>

- Run extract-cli with this file.

Expected results
- The string "Hello world from the $gettext function" has been
  successfully extracted without any error.
@gorkat
Copy link
Contributor

gorkat commented Jul 3, 2018

Hello,
I've made a fix but it has a dependency on #36. Hence, to avoid a painful rebase due to the breaking changes introduced for the support of all the vue-gettext functions, it will be submitted to integration when the dependencies will have been approved by another maintainer.

gorkat pushed a commit that referenced this issue Jul 19, 2018
…e-is-not-a-function

Issue #37 - Extract strings only when expression is a gettext function
@gorkat
Copy link
Contributor

gorkat commented Jul 19, 2018

Hello @escapedcat, this should be fixed now, I close this issue :)

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

No branches or pull requests

2 participants