All Projects â†’ streamich â†’ use-t

streamich / use-t

Licence: Unlicense license
🗺 Translations with React hooks

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language



🗺
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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].