@reactizer/intl
v0.28.0
Published
Reactizer's intl.
Downloads
18
Readme
@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
