react-i18n
An tiny i18n library for React JS. It makes use of the Context
API to support a hierarchy of language bundles (each of which can be loaded on demand) and the native Intl
package to provide some formatting utilities for common things like dates and currencies. You can easily include anything else as and when you need to.
A tiny bundle size is nice but makes this library also makes it easy for you to distribute your language text across many files and is setup for code splitting and dynamic imports. This is illustrated by the exmaple project which is hosted here.
Install
npm i @mpkelly/react-i18n
Demos
Features
- Tiny, treeshakable bundle - 1.4kB gzipped
- Clean code. No special components that take over your code base
- Hierarchical with support for dynamic imports and code splitting
- Extensible/customizable Markdown support: converts text values into
ReactNode
array - Supports dates, currencies and pluralization via native
Intl
package - Extend your design system components easily using
withI18N()
HOC - Includes React hook
useI18N
- Docs
- Tests