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

fallback locale deep key using tm throw error #1702

Open
4 tasks done
everyx opened this issue Jan 17, 2024 · 1 comment
Open
4 tasks done

fallback locale deep key using tm throw error #1702

everyx opened this issue Jan 17, 2024 · 1 comment

Comments

@everyx
Copy link

everyx commented Jan 17, 2024

Reporting a bug?

When a deep not exist current locale, but exist in fallback locale, it will throw error Cannot read properties of null (reading 'xxx')

Expected behavior

Use the value from the fallback locale

Reproduction

https://stackblitz.com/edit/vitejs-vite-zkwein?file=src%2FApp.vue,src%2Fmain.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.14.0 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^4.2.3 => 4.3.4 
    vite: ^4.4.9 => 4.4.9 
    vue: ^3.3.4 => 3.3.4 
    vue-i18n: ^9.3.0 => 9.3.0 
    vue-tsc: ^1.8.8 => 1.8.10

Screenshot

No response

Additional context

No response

Validations

@kazupon
Copy link
Member

kazupon commented May 13, 2024

Unfortunately, vue-i18n expects the message retrieved by tm to be an array, and the use case expectation is to resolve it using rt.
It also expects the messages retrieved in the array to have the same structure in this case en and ja.

If your application assumes a different message structure, as in this case, you will need to do the validation yourself.

@kazupon kazupon removed the Status: Review Needed Request for review comments label May 13, 2024
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

2 participants