Simple Localization for Next.js & React
Forget complex routing and scattered translation files. next-lang gives you one centralized place to manage your app's languages.
npm install next-lang
terminal
1npm install next-lang
2# or
3yarn add next-lang
4# or
5pnpm add next-lang
Key Features
Why choose next-lang?
A lightweight localization package designed specifically for Next.js and React developers.
Quick Setup
Wrap your app in a LangProvider and use the useLang() hook to access translations.
Centralized Translations
All translations are stored in one file, making it easier to maintain.
URL Stays Clean
No /en/, /de/, or routing hacks. Changing language doesn't affect the URL structure.
Language Switching
Use toggleLang() or setLang(lang) to switch languages in real time.
Open Source
Free to use, modify, and contribute to the project.
Benefits that make a difference
- Minimal setup, maximum control
- Centralized translation logic
- No URL rewriting or custom routing
- Works seamlessly with client-side rendering
- TypeScript support out of the box
translations.ts
export const translations = {
en: {
welcome: "Welcome to our app",
about: "About us",
contact: "Contact"
},
es: {
welcome: "Bienvenido a nuestra aplicación",
about: "Sobre nosotros",
contact: "Contacto"
}
}