Socket
Book a DemoInstallSign in
Socket

@nuxtjs/i18n

Package Overview
Dependencies
Maintainers
9
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nuxtjs/i18n

Internationalization for Nuxt

10.0.6
latest
Source
npmnpm
Version published
Weekly downloads
289K
-15.16%
Maintainers
9
Weekly downloads
 
Created

What is @nuxtjs/i18n?

@nuxtjs/i18n is a Nuxt.js module that provides internationalization (i18n) support for your Nuxt.js applications. It allows you to easily add multilingual support to your application, manage translations, and handle locale switching.

What are @nuxtjs/i18n's main functionalities?

Basic Setup

This code demonstrates the basic setup of the @nuxtjs/i18n module in a Nuxt.js project. It configures two locales (English and French) and sets English as the default locale. It also provides translation messages for the 'welcome' key in both languages.

{
  "modules": [
    "@nuxtjs/i18n"
  ],
  "i18n": {
    "locales": [
      { "code": "en", "name": "English" },
      { "code": "fr", "name": "Français" }
    ],
    "defaultLocale": "en",
    "vueI18n": {
      "fallbackLocale": "en",
      "messages": {
        "en": { "welcome": "Welcome" },
        "fr": { "welcome": "Bienvenue" }
      }
    }
  }
}

Locale Switching

This code demonstrates how to switch between locales in a Nuxt.js component using @nuxtjs/i18n. The $t function is used to translate the 'welcome' key, and the $i18n.setLocale method is used to change the current locale.

<template>
  <div>
    <p>{{ $t('welcome') }}</p>
    <button @click="$i18n.setLocale('en')">English</button>
    <button @click="$i18n.setLocale('fr')">Français</button>
  </div>
</template>

Dynamic Route Localization

This code demonstrates how to configure dynamic route localization with @nuxtjs/i18n. It maps the root path ('/') to '/accueil' for the French locale, allowing for localized URLs.

{
  "pages": {
    "index": {
      "en": "/",
      "fr": "/accueil"
    }
  }
}

Other packages similar to @nuxtjs/i18n

Keywords

nuxt

FAQs

Package last updated on 19 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.