1.1.2 • Published 2 years ago
i18n-nextjs v1.1.2
Get started
🐇 Quick start
Install i18n-nextjs
with via your package manager:
npm install i18n-nextjs
Then import the useTranslation
hook:
import { useTranslation } from "i18n-nextjs";
export const MyComponent = () => {
const t = useTranslation();
return (
<span>{t("key.to.value", {name: "My Name"})}</span>
)
}
All locales are stored in the locales
folder in the public folder of your project.
For every locale you need to create a file with the name of the locale. (e.g. en.json
)
Structure of the locale file:
{
"key": {
"to": {
"value": "Hello, {{name}}!"
}
}
}
👩🏻⚖️ License
- i18n-nextjs is MIT licensed.