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

1.6.2 • Public • Published



🗺
use-t

Translations for React.



Installation

npm i use-t


Reference

import {Provider, useT, withT, Trans, Consumer, context} from 'use-t';


Example

import {Provider, useT} from 'use-t';
 
const Hello = (props) => {
  const [t] = useT();
  return (
    <div>
      <div>
        {t('Hello')}, {props.name}!
      </div>
      <div>
        {t.t('hello_user')`Hello, ${props.name}!`}
      </div>
    </div>
  );
};
 
<Provider locale="de" map={{
  de: {
    main: {
      Hello: 'Hallo',
      hello_user: (name) => `Hi, ${name}!`
    }
  }
}}>
  <Hello name="Mike" />
</Provider>


License

Unlicense — public domain.

Readme

Keywords

none

Package Sidebar

Install

npm i use-t

Weekly Downloads

17

Version

1.6.2

License

Unlicense

Unpacked Size

24.1 kB

Total Files

16

Last publish

Collaborators

  • streamich