Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
nuxt-i18n
Advanced tools
i18n for your Nuxt project
yarn add nuxt-i18n # yarn
npm i nuxt-i18n # npm
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!
All contributions are welcome! If you would like to make some changes, follow these steps:
cd my-nuxt-project
mkdir modules
git clone git@github.com:<username>/nuxt-i18n.git modules/nuxt-i18n # ssh
git clone https://github.com/<username>/nuxt-i18n.git modules/nuxt-i18n # https
// nuxt.config.js
{
modules: [
['./modules/nuxt-i18n', {
// options...
}]
]
}
cd modules/nuxt-i18n/
yarn # yarn
npm i # npm
git checkout -b my-new-feature
yarn lint && yarn test # yarn
npm run lint && npm test # npm
git clone git@github.com:<username>/nuxt-i18n.git # ssh
git clone https://github.com/<username>/nuxt-i18n.git # https
cd nuxt-i18n
yarn # yarn
npm i # npm
git checkout -b my-new-feature
yarn docs:dev # yarn
npm run docs:dev # npm
docs/
directoryIf you're adding new pages, make sure you add them to the table of contents in
docs/.vuepress/config
If you have any questions or issues, check out Discord server.
MIT License - Copyright (c) Nuxt Community
FAQs
i18n for Nuxt
The npm package nuxt-i18n receives a total of 22,105 weekly downloads. As such, nuxt-i18n popularity was classified as popular.
We found that nuxt-i18n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.