@reactizer/intl
Reactizer's intl.
Last updated a year ago by oreqizer .
MIT · Original npm · Tarball · package.json
$ cnpm install @reactizer/intl 
SYNC missed versions from official npm registry.

@reactizer/intl

A minimalistic node-polyglot based React hooks-based i18n solution.

API

API of the t function found in the context mirrors node-polyglot's API.

Core

Mount your provider:

import { IntlProvider } from "@reactizer/intl";

const locale = {
  id: "en-GB",
  translations: {/* ... */},
};

<IntlProvider locale={locale} onChange={id => fetch(/* ... */)}>
  <Root />
</IntlProvider>

Use the useIntl hook (or IntlConsumer):

import { useIntl } from "@reactizer/intl";

const MyComponent = () => {
  const intl = useIntl();
  
  return (
    /* ... */
  );
};

Translate

There's a Translate component:

import Translate from "@reactizer/intl/lib/Translate";

<Translate t="lmao" />

License

MIT

Current Tags

  • 0.28.0                                ...           latest (a year ago)

12 Versions

  • 0.28.0                                ...           a year ago
  • 0.27.1                                ...           a year ago
  • 0.27.0                                ...           a year ago
  • 0.24.3                                ...           a year ago
  • 0.26.0                                ...           a year ago
  • 0.25.0                                ...           a year ago
  • 0.24.5                                ...           a year ago
  • 0.24.1                                ...           a year ago
  • 0.23.0                                ...           a year ago
  • 0.22.0                                ...           a year ago
  • 0.21.4                                ...           a year ago
  • 0.20.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |