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

Error for nested array followed by non-array in i18n custom block #80

Closed
4 tasks done
matthew-white opened this issue Jan 20, 2022 · 1 comment · Fixed by #98
Closed
4 tasks done

Error for nested array followed by non-array in i18n custom block #80

matthew-white opened this issue Jan 20, 2022 · 1 comment · Fixed by #98
Labels

Comments

@matthew-white
Copy link

Reporting a bug?

Using Vue 3, Vue I18n v9, and vue-i18n-loader v4.1.0, I'm not able to build a particular component that uses an i18n custom block. Looking at the messages in the block, I think I have tracked down the issue to a specific case: an array where one element of the array is itself an array, but the next element is not an array. For example, when I try to build a component with the following i18n custom block, I see an error message:

<i18n>
{
  "en": {
    "foo": [
      [
        "bar"
      ],
      "baz"
    ]
  }
}
</i18n>

However, I am able to build a component with the following i18n custom block:

<i18n>
{
  "en": {
    "foo": [
      [
        "bar"
      ],
      [
        "baz"
      ]
    ]
  }
}
</i18n>

The error message I see is:

Module parse failed: Unexpected token (10:17)
File was processed with these loaders:
 * ./node_modules/@intlify/vue-i18n-loader/lib/index.js
 * ./node_modules/cache-loader/dist/cjs.js
 * ./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js
You may need an additional loader to handle the result of these loaders.
|           [
|             (ctx) => {const { normalize: _normalize } = ctx;return _normalize(["bar"])}
>           ](ctx) => {const { normalize: _normalize } = ctx;return _normalize(["baz"])},
|
|         ]

Looking at ](ctx), it looks like a comma is missing between ] and (ctx).

Expected behavior

I am migrating a project from Vue 2 to Vue 3, and I was previously able to build this component. It would be great not to have to change the structure of the messages, because the translation platform we use would register that as completely new translations.

Reproduction

Please let me know if any information would be helpful in addition to the i18n custom block above.

Issue Package

vue-i18n-loader

System Info

System:
  OS: macOS 10.15.7
Binaries:
  Node: 14.17.6 - /usr/local/bin/node
  npm: 6.14.15 - /usr/local/bin/npm
npmPackages:
  @intlify/vue-i18n-loader: ~4 => 4.1.0
  vue: ~3 => 3.2.26
  vue-i18n: ~9 => 9.1.9

Screenshot

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the README
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion.
@matthew-white matthew-white added the Status: Review Needed Request for review comments label Jan 20, 2022
matthew-white added a commit to getodk/central-frontend that referenced this issue Mar 14, 2022
@kazupon kazupon added Type: Bug Bug or Bug fixes Package: bundle-utils and removed Status: Review Needed Request for review comments labels Mar 22, 2022
@kazupon
Copy link
Member

kazupon commented Mar 22, 2022

Thank you for your reporting!
Sorry, for my late response.

This is @intlify/bundle/utils issue.
We'll fix 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

Successfully merging a pull request may close this issue.

2 participants