1.1.18 • Published 2 years ago

@rcp/use.i18n v1.1.18

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@rcp/use.i18n

NPM version NPM Downloads

A react hook for using i18n

Installation

npm install @rcp/use.i18n
# or use yarn
yarn add @rcp/use.i18n

Usage

import useI18n from '@rcp/use.i18n'

function App({ locale = {}, language = 'zh' } = {}) {
  const { i18n } = useI18n(
    {
      zh: {
        title: '标题',
        content: '${1}, 内容'
      },
      en: {
        title: 'Title',
        content: '${1}, Content'
      }
    },
    { locale, language }
  )

  return <p>{i18n('content', i18n('title'))}</p>
}

API

Related

Authors

This library is written and maintained by imcuttle, <a href="moyuyc95@gmail.com""moyuyc95@gmail.com>.

License

MIT

1.1.18

2 years ago

1.1.17

2 years ago

1.1.16

3 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.8

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago