Closed ZIFEIYU2023 closed 9 months ago
so sad
I tried useNuxtApp().$i18n.localeProperties.value
can be used, but useI18n()
cannot
I can't access your reproduction, maybe you need to change some permissions?
Actually, this is expected behaviour and enforced in vue-i18n
, the general convention is to only allow using composables in a setup
function.
As you already found out, useNuxtApp().$i18n
should allow you to access the same values (global scope).
Environment
Reproduction
https://codesandbox.io/p/devbox/example-i18n-wsc2q9?file=%2Fmiddleware%2F01.example.global.ts%3A6%2C1
Describe the bug
Use usei18n() in middleware , SyntaxError: Must be called at the top of a
setup
functionAdditional context
No response
Logs