Composition API for `@nuxtjs/i18n` in Nuxt 2.x
npm install nuxt-i18n-composableComposition API for @nuxtjs/i18n in Nuxt 2.x
Use this package to make use of the composition API while using Nuxt 2.x.
This is heavily inspired by vue-i18n-composable (by Anthony Fu) and should only be used until there is an official solution by nuxt-i18n.
If you have to use nuxt-i18n (which got deprecated), please use version 0.1.1 of this package.
npm i @nuxtjs/i18n nuxt-i18n-composable @nuxtjs/composition-api
Simply configure @nuxtjs/i18n as usual.
In components, you import useI18n from nuxt-i18n-composable.
``vue
{{ t('language') }} or {{ language }}
{
"en": {
"language": "English"
},
"de": {
"language": "Deutsch"
}
}
`
You can access the nuxt-i18n instance like this:
`vue``
MIT License © 2021 NBRX AG