inno-trans-react-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

inno-trans-react-plugin

A inno-trans plugin for react.

npm

Install

npm i inno-trans-react-plugin

Example

const InnoTrans = require('inno-trans');
const InnoTransReactPlugin = require('inno-trans-react-plugin');

const trans = InnoTrans({
    locale: 'en',
    message: {
        en: {
            'hello': 'hello!'
        },
        ko: {
            'hello': '안녕!'
        }
    },
    plugins: [InnoTransReactPlugin] // 1. Add a plugin.
})

function App(){
    const {t} = trans.useT() // 2. You can now use the `useT()` hook.

    return <span>{ t('hello') }</span> // => "<span>hello</span>"
}

trans.locale('ko') // App rerenders like "<span>안녕!</span>"

Related

  • inno-trans - 📜 simple localization library (inspired by laravel translation)

License

MIT

Package Sidebar

Install

npm i inno-trans-react-plugin

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.21 kB

Total Files

6

Last publish

Collaborators

  • skt-t1-byungi