Quick snippet, log inside a client check if to avoid server logs get forwarded to browser console, it works server side too.
Im mostly writing this to rember it, i allways forget how to doit ๐
๏ธ.
Tested in @nuxt-i18n
7.X on a nuxt 2 project
setup(props, ctx ) {
const { root } = ctx;
// all the stuff is in the root, who would imagine that ha
if (process.client) {
// ctx.root.$i18n.t
console.log(ctx.root.$i18n.t('my.message.path'))
}
}
And that's how to use $t
is nuxt-i18n
inside setup
function folks.
Top comments (1)
const { t: $t } = useI18n()
console.log($('message'))