Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laskydev/uselanguagenext
Quick and easy translation of your next.js applications
https://github.com/laskydev/uselanguagenext
i18 i18n javascript nextjs npm npm-package reactjs translation
Last synced: about 1 month ago
JSON representation
Quick and easy translation of your next.js applications
- Host: GitHub
- URL: https://github.com/laskydev/uselanguagenext
- Owner: laskydev
- Created: 2022-12-14T00:08:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-08T20:16:09.000Z (10 months ago)
- Last Synced: 2024-09-30T10:23:33.865Z (about 2 months ago)
- Topics: i18, i18n, javascript, nextjs, npm, npm-package, reactjs, translation
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/use-language-next?activeTab=readme
- Size: 30.8 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# useLanguageNext
Quick and easy translation of your next.js applications
Only works on pages router.
## Installation
```bash
npm i use-language-next
```## Usage/Examples
```javascript
import useLanguage from 'use-language-next'function App() {
const { handleLanguage } = useLanguage()return (
{handleLanguage({
'es-MX': 'Hola Mundo',
'en-US': 'Hello World',
'fr': 'Bonjour Monde'
})}
)
}
```The key you must use is the same as the one you configured in the i18 of the next.config
```javascript
module.exports = {
i18n: {
locales: ['en-US', 'es-MX' , 'fr'], //Use this values for key in handleLanguage parameters
defaultLocale: 'en-US',
},
}
```