npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@laramab/nuxt-i18n

v6.9.3

Published

i18n for Nuxt

Downloads

4

Readme

nuxt-i18n

i18n for your Nuxt project

Links

Features

  • Integration with vue-i18n
  • Automatic routes generation and custom paths
  • Search Engine Optimization
  • Lazy-loading of translations messages
  • Redirection based on auto-detected language
  • Different domain names for different languages
  • Storing current locale and messages with Vuex

Setup

yarn add nuxt-i18n # yarn
npm i nuxt-i18n # npm

Basic usage

Firstly, you need to add nuxt-i18n to your Nuxt config.

// nuxt.config.js

{
  modules: [
    [
      'nuxt-i18n',
      {
        locales: ['en', 'es'],
        defaultLocale: 'en',
        vueI18n: {
          fallbackLocale: 'en',
          messages: {
            en: {
              greeting: 'Hello world!'
            },
            es: {
              greeting: '¡Hola mundo!'
            }
          }
        }
      }
    ]
  ]
}

Then you can start using nuxt-i18n in your Vue components!

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

    <nuxt-link
      v-if="$i18n.locale !== 'en'"
      :to="switchLocalePath('en')"
    >
      English
    </nuxt-link>

    <nuxt-link
      v-if="$i18n.locale !== 'es'"
      :to="switchLocalePath('es')"
    >
      Español
    </nuxt-link>
  </main>
</template>

If you would like to find out more about how to use nuxt-i18n, check out the docs!

Contributing

All contributions are welcome! If you would like to make some changes, follow these steps:

  • Fork the project and clone it in your existing Nuxt project:
cd my-nuxt-project
mkdir modules
git clone [email protected]:<username>/nuxt-i18n.git modules/nuxt-i18n # ssh
git clone https://github.com/<username>/nuxt-i18n.git modules/nuxt-i18n # https
  • Edit your Nuxt config to use the local module:
// nuxt.config.js

{
  modules: [
    ['./modules/nuxt-i18n', {
      // options...
    }]
  ]
}
  • Install the module's dependencies:
cd modules/nuxt-i18n/
yarn # yarn
npm i # npm
  • Create a new branch for your changes:
git checkout -b my-new-feature
  • Code, code, code!
  • Run ESLint and Jest
yarn lint && yarn test # yarn
npm run lint && npm test # npm
  • Commit and push your changes
  • Submit awesome PRs

Documentation

  • Fork and clone the project:
git clone [email protected]:<username>/nuxt-i18n.git # ssh
git clone https://github.com/<username>/nuxt-i18n.git # https
  • Install the dependencies:
cd nuxt-i18n
yarn # yarn
npm i # npm
  • Create a new branch for your changes:
git checkout -b my-new-feature
  • Start the docs server:
yarn docs:dev # yarn
npm run docs:dev # npm
  • Write some doc by editing files in docs/ directory

If you're adding new pages, make sure you add them to the table of contents in docs/.vuepress/config

  • Commit and push your changes
  • Once you're done, submit that shiny PR!

Issues, questions & requests

If you have any questions or issues, check out Discord server.

License

MIT License - Copyright (c) Nuxt Community