https://github.com/atomicpages/i18next-pseudo-localizer
A pseudolocalization plugin for i8next
https://github.com/atomicpages/i18next-pseudo-localizer
Last synced: about 1 month ago
JSON representation
A pseudolocalization plugin for i8next
- Host: GitHub
- URL: https://github.com/atomicpages/i18next-pseudo-localizer
- Owner: atomicpages
- License: mit
- Created: 2020-11-07T18:18:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-09T04:13:52.000Z (over 5 years ago)
- Last Synced: 2025-11-24T06:18:16.430Z (9 months ago)
- Language: TypeScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# i18next-pseudo-localizer
## Install
```sh
npm i i18next i18next-pseudo-localizer
```
## Basic Usage
`i18next-pseudo-localizer` has one class export and a pre-constructed variable (with sensible defaults):
```js
import i18next from 'i18next';
import { pseudo } from 'i18next-pseudo-localizer';
i18next.use(pseudo).init({
// ...,
postProcess: ['pseudo'],
});
```
### Pass Options
To pass custom options, construct a new instance of `Pseudo`:
```js
import i18next from 'i18next';
import { Pseudo } from 'i18next-pseudo-localizer';
i18next
.use(
new Pseudo({
// pass options
})
)
.init({
// ...,
postProcess: ['pseudo'],
});
```
## Options
In addition to all options supported by [`pseudo-localizer`](https://github.com/atomicpages/pseudo-localizer#options), here are a few extra options:
| Name | Type | Default Value | Required | Description |
| ------------------- | ---------- | ------------- | -------- | ---------------------------------------- |
| `languagesToPseudo` | `string[]` | `['en']` | No | An array of languages to pseudo localize |
| `enabled` | `boolean` | `true` | No | Set false to disable |
```js
import i18next from 'i18next';
import { Pseudo } from 'i18next-pseudo-localizer';
i18next
.use(
new Pseudo({
enabled: process.env.NODE_ENV === 'development',
languagesToPseudo: ['en-US', 'es-MX'],
// override pseudo-localizer options
prefix: '[',
suffix: ']',
letterMultiplier: 3,
})
)
.init({
// ...,
postProcess: ['pseudo'],
});
```
## Credits
Heavily inspired by [i18next-pseudo](https://github.com/MattBoatman/i18next-pseudo).