Skip to content

fluejs/nuxt-i18n

Repository files navigation

@fluejs/nuxt-i18n

Full documentation

@fluejs/nuxt-i18n is a simple yet flexible module for Nuxt that helps localize your project. Here’s what the module offers:

  • Definition of dictionaries (messages) in JSON files, with processing and chunk splitting during the build process
  • Language prefixes in routing paths, enhancing SEO localization
  • Built-in interpolation and pluralization when accessing the dictionary using @fluejs/txtag

Basic setup

Install the module

# via npm
npm install --save-dev @fluejs/nuxt-i18n
# via yarn
yarn add -D @fluejs/nuxt-i18n

Register the module

nuxt.config.ts

export default defineNuxtConfig({
    modules: ['@fluejs/nuxt-i18n'],
    i18n: {
        locales: ['en', 'ru'],
        defaultLocale: 'en',
        dictionary: '~/app/dictionary.json',
    },
});

Create dictionary file

app/dictionary.json

{
    "greeting": {
        "en": "Hello!",
        "ru": "Привет!"
    }
}

Display your first message

<template>
    <p>{{ $t('greeting') }}</p>
</template>

About

Simple internationalization module for Nuxt 3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published