Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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',
},
}
```