kazupon / vue-i18n

:globe_with_meridians: Internationalization plugin for Vue.js

Home Page:https://kazupon.github.io/vue-i18n/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vue 2.6 + vue-i18n-bridge breaks in legacy mode

Hawxy opened this issue · comments

commented

Reporting a bug?

I'm running latest vue-i18n-bridge with the below settings:

  allowComposition: true,
  legacy: true,
  globalInjection: true

However, this breaks with:
Error in beforeMount hook: "TypeError: Cannot read properties of undefined (reading 'locale')"
in any component that calls useI18n().

When debugging, you can see that the composer variable is undefined.

Expected behavior

vue-i18n-bridge legacy mode + Vue 2.6 works.

Reproduction

https://github.com/Hawxy/vue-i18n-bridge-repo

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (32) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 12.37 GB / 31.92 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.12.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.674.0), Chromium (107.0.1418.35)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @vue/cli-plugin-babel: ~5.0.8 => 5.0.8
    @vue/cli-plugin-eslint: ~5.0.8 => 5.0.8
    @vue/cli-plugin-typescript: ~5.0.8 => 5.0.8
    @vue/cli-service: ~5.0.8 => 5.0.8
    @vue/composition-api: ^1.7.1 => 1.7.1
    @vue/eslint-config-typescript: ^11.0.2 => 11.0.2
    vue: 2.6.14 => 2.6.14
    vue-i18n: ^8.28.2 => 8.28.2
    vue-i18n-bridge: ^9.2.2 => 9.2.2
    vue-template-compiler: 2.6.14 => 2.6.14

Screenshot

image

Additional context

No response

Validations

Thank you for your reporting!

allowComposition: true isn't supported in Vue 2.x + Vue I18n v8.x
This option is supported for Vue 3 + Vue I18n v9.x
The purpose of this option is to migrate from the Options API to the Composition API in our App.

If you would use useI18n composable function in Vue 2, we would recommend that you will have migrated your Vue2 app to Vue 3, then use that option.

Thanks!