An open API service indexing awesome lists of open source software.

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

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).