You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on a Nuxt 3 project using the @nuxtjs/i18n module, and I've created a custom module within my project but as separate package(Im using turborepo). I want to correctly use or extend the i18n types from @nuxtjs/i18n in this custom module.
Im using this approach from your docs, but nuxt doesn't know about i18n:registerModule hook and other global functions like $t() or $i18n object in nuxt context
import{createResolver,defineNuxtModule}from'@nuxt/kit'exportdefaultdefineNuxtModule({asyncsetup(options,nuxt){const{ resolve }=createResolver(import.meta.url)nuxt.hook('i18n:registerModule',register=>{register({// langDir path needs to be resolvedlangDir: resolve('./lang'),locales: [{code: 'en',file: 'en.json',},{code: 'fr',file: 'fr.json',},]})})}})
How to add types from @nuxtjs/i18n into my package without installing module directly
Thank you in advance!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’m working on a Nuxt 3 project using the @nuxtjs/i18n module, and I've created a custom module within my project but as separate package(Im using turborepo). I want to correctly use or extend the i18n types from @nuxtjs/i18n in this custom module.
Im using this approach from your docs, but nuxt doesn't know about i18n:registerModule hook and other global functions like $t() or $i18n object in nuxt context
How to add types from @nuxtjs/i18n into my package without installing module directly
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions