question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

At which point of the nuxt lifecycle is i18n ready?

See original GitHub issue

I want to use this.$i18n in a computed property in one of my components, e.g.

topLevelDomain() {
    return getTldForLocale(this.$i18n.localeProperties)
}

However, it seems that $i18n is not initialized (correctly) at this point of time, because console.log(this.$i18n.locale) logs { code: ""}

This only happens in production mode (nuxt build, nuxt start), and not in dev mode (nuxt).

Is there anything to consider in production mode?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
rchlcommented, May 18, 2021

It’s already initialized when your component’s or page’s code runs. So there must be something else in your project that causes this issue.

0reactions
rchlcommented, May 18, 2021

That would indicate some bigger issue at play, I’d think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt Lifecycle
The Nuxt lifecycle describes what happens after the build phase, where your application is bundled, chunked and minified. What happens after this phase ......
Read more >
A Guide to Localizing with Nuxt.js | Phrase
In this tutorial, we'll use a library called nuxt-i18n , based on vue-i18n , with some Nuxt-specific localization options. Before installing the ...
Read more >
Nuxt 3 Stable Launch – All the details from Nuxt Nation 2022
Nuxt 3 started its beta phase last October and after 400 days, 29000 commits on Github, and 320 contributors a stable version of...
Read more >
Multi-Language Blog with Nuxt content module.
To do a multi-language blog the first thing you need is to add i18n (Internationalization) module to your app. Of course. Nuxt already...
Read more >
Why Nuxt.js is the perfect framework for building static websites
So why are we using Nuxt for this project? Let's take a close look at layouts, pages and lifecycle hooks. Layouts. Layout is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found