0.28.0 • Published 4 years ago

@reactizer/intl v0.28.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

@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

0.28.0

4 years ago

0.27.1

4 years ago

0.27.0

4 years ago

0.26.0

4 years ago

0.24.5

4 years ago

0.24.3

4 years ago

0.25.0

4 years ago

0.24.1

4 years ago

0.23.0

4 years ago

0.21.4

4 years ago

0.22.0

4 years ago

0.20.0

4 years ago