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 code : 2 after update to 0.10.0 @intlify/unplugin-vue-i18n #250

Open
4 tasks done
cedricvoinnet opened this issue Mar 23, 2023 · 3 comments
Open
4 tasks done
Labels
Status: Review Needed Request for review comments

Comments

@cedricvoinnet
Copy link

cedricvoinnet commented Mar 23, 2023

Reporting a bug?

For a translation like

{
  "address": "user{'@'}domain"
}

I get an error when running webpack build :

$ webpack --config webpack.config.js
[unplugin-vue-i18n]  2 (error code: 2) in /locales/en.json
  target message: user{'@'}domain
  target message path: address

  1  |  user{'@'}domain
   |              ^^^^^

[unplugin-vue-i18n]  2 (error code: 2) in /locales/fr.json
  target message: utilisateur{'@'}domaine
  target message path: address

  1  |  utilisateur{'@'}domaine
   |                     ^^^^^^

/node_modules/@intlify/unplugin-vue-i18n/lib/index.cjs:640
      throw new Error(errMssage);
            ^
    at onError (/node_modules/@intlify/unplugin-vue-i18n/lib/index.cjs:640:13)
    at newOptions.onError (/node_modules/@intlify/bundle-utils/lib/codegen.js:133:13)
    at emitError (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:197:13)
    at readTokenInPlaceholder (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:703:21)
    at readToken (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:776:20)
    at Object.nextToken (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:823:16)
    at parseMessage (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:1029:50)
    at parseResource (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:1096:25)
    at Object.parse (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:1111:21)
    at baseCompile (/node_modules/@intlify/bundle-utils/node_modules/@intlify/message-compiler/dist/message-compiler.prod.cjs:1421:24)
    at generateMessageFunction (/node_modules/@intlify/bundle-utils/lib/codegen.js:137:67)
    at Object.enterNode (/node_modules/@intlify/bundle-utils/lib/json.js:140:89)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:45:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverse (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:49:13)
    at traverseNodes (/node_modules/jsonc-eslint-parser/lib/parser/traverse.js:55:5)
    at generateNode (/node_modules/@intlify/bundle-utils/lib/json.js:87:45)
    at generate (/node_modules/@intlify/bundle-utils/lib/json.js:60:22)
    at Object.transform (/node_modules/@intlify/unplugin-vue-i18n/lib/index.cjs:433:48)
    at Object.transform (/node_modules/unplugin/dist/webpack/loaders/transform.js:96:38)
    at LOADER_EXECUTION (/node_modules/loader-runner/lib/LoaderRunner.js:132:14)
    at runSyncOrAsync (/node_modules/loader-runner/lib/LoaderRunner.js:133:4)
    at iterateNormalLoaders (/node_modules/loader-runner/lib/LoaderRunner.js:251:2)
    at /node_modules/loader-runner/lib/LoaderRunner.js:224:4
    at /node_modules/webpack/lib/NormalModule.js:836:15
    at eval (eval at create (/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:12:1)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
    at runNextTicks (node:internal/process/task_queues:64:3)
    at process.processImmediate (node:internal/timers:447:9)

Expected behavior

It should build.

Reproduction

This example : https://vue-i18n.intlify.dev/guide/essentials/syntax.html#literal-interpolation

Issue Package

unplugin-vue-i18n

System Info

System:
    OS: Linux 5.19 Ubuntu 22.10 22.10 (Kinetic Kudu)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Memory: 16.93 GB / 31.22 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 18.7.0 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 7.10.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 111.1.49.120
    Chrome: 111.0.5563.64
    Firefox: 111.0.1
  npmPackages:
    vue: ^3.1.0 => 3.2.47 
    vue-i18n: ^9.2.2 => 9.2.2 
    webpack: ^5.68.0 => 5.76.2

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.
@cedricvoinnet cedricvoinnet added the Status: Review Needed Request for review comments label Mar 23, 2023
Copy link
Member

kazupon commented Mar 29, 2023

@ is special character
You can see the docs
https://vue-i18n.intlify.dev/guide/essentials/syntax.html#special-characters

You can avoid with literal interpolation
https://vue-i18n.intlify.dev/guide/essentials/syntax.html#literal-interpolation

Thanks!

@kazupon kazupon closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2023
@cedricvoinnet
Copy link
Author

As you can see in my example and error message, I am using the literal interpolation to avoid the linked message behavior with @.

I was using this syntax before but after updating to 0.10.0, I have an error on this syntax.

@kazupon kazupon reopened this Mar 31, 2023
@Slokilla
Copy link

Slokilla commented Jun 19, 2023

up, same problem here. I have exactly the same issue, and I can't update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review Needed Request for review comments
Projects
None yet
Development

No branches or pull requests

3 participants