t does not work in script setup #1643
Unanswered
torbentschechne
asked this question in
Q&A
Replies: 2 comments
-
Update: It works when setting legacy to false.
Still I wonder if I need to declare |
Beta Was this translation helpful? Give feedback.
0 replies
-
I thought maybe I can do it like this to prevent defining the
But this does not work. Within my component, it states then that |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there,
I have a Vue3 application with Composition API and I use
$t
in the<template>
tag all the time. That works. Now I need to use it within myscript setup
and$t
is not recognized. I did the following:I added the
allowComposition: true,
to the createI18n options:And within my <script setup> I did :
But the name remains empty, so this does not work. When I use the same tag in the template with
{{ $t('navigation.dashboard') }}
it works.Now I have two questions:
t
or$t
inscript setup
without importing it in every single component? I looked into the docs, but this is not clear to me currently.Beta Was this translation helpful? Give feedback.
All reactions