https://github.com/mpkelly/react-i18n
A tiny (1.4kb gzipped) yet sophisticated i18n library for React JS. Supports lazy loading, code-splitting, hierarchical language bundles, markdown and more.
https://github.com/mpkelly/react-i18n
code-splitting i18n internationalization localization react reactjs typescript
Last synced: about 2 months ago
JSON representation
A tiny (1.4kb gzipped) yet sophisticated i18n library for React JS. Supports lazy loading, code-splitting, hierarchical language bundles, markdown and more.
- Host: GitHub
- URL: https://github.com/mpkelly/react-i18n
- Owner: mpkelly
- License: mit
- Created: 2020-06-30T08:50:03.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T11:46:19.000Z (about 3 years ago)
- Last Synced: 2025-08-08T19:54:11.573Z (7 months ago)
- Topics: code-splitting, i18n, internationalization, localization, react, reactjs, typescript
- Language: TypeScript
- Homepage: https://codesandbox.io/s/infallible-framework-wkmgt?file=/src/Home.tsx
- Size: 2.36 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.MD
Awesome Lists containing this project
README
# 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](https://github.com/mpkelly/react-i18n/tree/master/packages/react-i18n-examples) which is hosted [here](https://mpkelly.github.io/react-i18n).
[Compare on Bundlephobia](https://bundlephobia.com/result?p=@mpkelly/react-i18n@0.0.9)
### Install
`npm i @mpkelly/react-i18n`
### Demos
- [Code splitting / general demo](https://codesandbox.io/s/loving-buck-jo6p6?file=/src/index.tsx)
### Features
- [x] Tiny, treeshakable bundle - 1.4kB gzipped
- [x] Clean code. No special components that take over your code base
- [x] Hierarchical with support for dynamic imports and code splitting
- [x] Extensible/customizable Markdown support: converts text values into `ReactNode` array
- [x] Supports dates, currencies and pluralization via native `Intl` package
- [x] Extend your design system components easily using `withI18N()` HOC
- [x] Includes React hook `useI18N`
- [ ] Docs
- [x] Tests
### Quick Start
```TypeScript
```
### API