use-language-next
TypeScript icon, indicating that this package has built-in type declarations

0.2.17 • Public • Published

useLanguageNext

Quick and easy translation of your next.js applications

Installation

npm i use-language-next

Usage/Examples

import useLanguage from 'use-language-next'

function App() {
  const { handleLanguage } = useLanguage()

  return (
      <p>
        {handleLanguage({
            'es-MX': 'Hola Mundo', 
            'en-US': 'Hello World',
            'fr': 'Bonjour Monde'
        })}
      </p>
  )
}

The key you must use is the same as the one you configured in the i18 of the next.config

module.exports = {
  i18n: {
    locales: ['en-US', 'es-MX' , 'fr'], //Use this values for key in handleLanguage parameters
    defaultLocale: 'en-US',
  },
}

Package Sidebar

Install

npm i use-language-next

Weekly Downloads

1

Version

0.2.17

License

ISC

Unpacked Size

3.67 kB

Total Files

8

Last publish

Collaborators

  • laskydev