-
-
Notifications
You must be signed in to change notification settings - Fork 381
Closed
Description
vue & vue-i18n version
- vue: 3.0.5
- vue-i18n: 9.0.0-rc.6
- vite: 2.0.0-beta.69
Hi, I am upgrading my Vue2 project to vue3 and followed the vue 3 and vue-i18n-next docs to setup the project using Vite.
However, I get this.$t is not a function error in my SFC vue component. BTW, I am using the legacy options api.
It seems the global $t is not assigned for some reason. Looking for some hints to resolve this issue.
// main.ts
import { createApp } from "vue";
import App from "./App.vue";
...
import { createI18n } from "vue-i18n";
const app = createApp(App);
const i18n = createI18n({
locale: "en",
fallbackLocale: "en",
silentFallbackWarn: true,
messages: {
en: {
title: "Hello",
},
},
});
app.use(i18n);
app.mount("#app");
// App.vue
<template>
<div>{{ $t('title') }}</div>
...
</template>
<script lang="ts">
export default {
};
</script>
Metadata
Metadata
Assignees
Labels
No labels