How to use useI18n
inside a Pinia store ?
#2938
Unanswered
mrleblanc101
asked this question in
Help and Questions
Replies: 1 comment 1 reply
-
I found a workaround which is: const nuxtApp = useNuxtApp();
const { t } = nuxtApp.$i18n; But I'm not sure if it's legit. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
How can I use
t()
fromuseI18n()
from the@nuxt/i18n
package inside Pinia to translate a string ?If I try
const { t } = useI18n()
inside asetup
store, I get this error:I don't understand since it says:
Must be called at the top
, it's the first line.of a
setupfunction
, it's a setup store, so I should be able to use composable inside it.Beta Was this translation helpful? Give feedback.
All reactions