@loveholidays/phrasebook
Advanced tools
Comparing version 0.0.4 to 1.0.0
# @loveholidays/phrasebook | ||
## 1.0.0 | ||
### Major Changes | ||
- 4107522: V1 release | ||
## 0.0.4 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@loveholidays/phrasebook", | ||
"version": "0.0.4", | ||
"version": "1.0.0", | ||
"description": "A lightweight drop-in for i18next users", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
# Phrasebook | ||
A lightweight drop-in for i18next users looking to translate their projects. | ||
A lightweight drop-in for `react-i18next` users looking to translate their projects. Currently in production on www.loveholidays.com. | ||
loveholidays made Phrasebook for our [website](https://www.loveholidays.com/). | ||
## Why phrasebook? | ||
It supports tree-shaking, and generates less JavaScript than i18next. | ||
- Tree-shakeable | ||
- Like for like interface with `react-i18next` | ||
- Native ESM module | ||
- Small bundle size (<1kb) | ||
Phrasebook supports tree shaking to help reduce the client side bundle. On our site this saved us 12kB compared to using i18next. | ||
We leverage `TFunction` types in our site which are not exported properly from `i18next` without including the entire bundle. With this package you have all the types you need alongside a fully working set of functions that translate i18next files. | ||
## Usage | ||
This package uses native [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and does not provide a CommonJS export. | ||
### Bundle size comparisons | ||
| Package | Bundle size | Difference | | ||
| ------------------------ | ----------------------------------------------------------------------- | ------------------------------- | | ||
| react-i18next | [6.5kb](https://bundlephobia.com/package/react-i18next@11.16.2) | | | ||
| @loveholidays/phrasebook | [883b](https://bundlephobia.com/package/@loveholidays/phrasebook@0.0.4) | 736% smaller than react-i18next | | ||
| @lingui/react | [2.5kb](https://bundlephobia.com/package/@lingui/react@3.13.2) | 260% smaller than react-i18next | | ||
## Installation | ||
Currently available on [NPM](https://www.npmjs.com/package/@loveholidays/phrasebook) | ||
``` | ||
$ npm i @loveholidays/phrasebook --save | ||
``` | ||
### Usage | ||
As this is a drop-in replacement usage is the same as i18next. For example if you are currently using react-i18next you can replace you imports like so: | ||
@@ -14,0 +35,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23558
0
50