Access global property of i18n instance
See original GitHub issueHi,
is it possible to access the global property of the i18n instance for usage outside of components? I couldn’t find a way, so my current workaround is to use vue-i18n without the nuxt module and create my own plugin which exports i18n instance:
export const i18n = createI18n({
legacy: false,
globalInjection: true,
locale: 'en',
messages: {
en,
},
})
export default defineNuxtPlugin((nuxt) => {
const { vueApp } = nuxt
vueApp.use(i18n)
})
Best regards David
Issue Analytics
- State:
- Created a year ago
- Comments:6
Top Results From Across the Web
General - Vue I18n - Intlify
If the I18n#mode is 'legacy' , then you can access to a global VueI18n instance, else then I18n#mode is 'composition' , you can...
Read more >Register $t globally · Issue #69 · kazupon/vue-i18n
Please register $t globally per default. Now we need each time: import Vue from 'vue' const $t = Vue.t // before we can...
Read more >How to use global variables in Vue.js templates?
hello in my template (vue files, which was used as components in router). My components' syntax is like <template> <div id="myid"> {{like $i18n....
Read more >API references | Vue I18n
If not specified component locale messages, localize with global locale messages. If you specified locale , localize the locale messages of ...
Read more >The Ultimate Vue Localization Guide
Let's construct the Vue I18n instance in a new module. ... We use i18n.global to access Vue I18n's global, app-wide scope.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
UPDATE: This works in dev and production
Original Answer
+1. This works in dev but breaks in production
@brunokunace I think the problem is due to SSR too but unfortunately I dont know how to help