# @cungminh2710/pseudolocalize

> Several implementation of pseudolocalizing ICU strings

Latest version **3.0.0** (published 2025-04-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @cungminh2710/pseudolocalize
pnpm add @cungminh2710/pseudolocalize
yarn add @cungminh2710/pseudolocalize
bun add @cungminh2710/pseudolocalize
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2025-04-05 |
| First published | 2022-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Minh Cung |
| Maintainers | cungminh2710 |
| Keywords | pseudolocalize, icu, i18n, l10n |

## Links

- npm: https://www.npmjs.com/package/@cungminh2710/pseudolocalize
- Repository: https://github.com/cungminh2710/pseudolocalize
- Homepage: https://github.com/cungminh2710/pseudolocalize#readme
- Issues: https://github.com/cungminh2710/pseudolocalize/issues
- npm.io page: https://npm.io/package/@cungminh2710/pseudolocalize

## Alternatives

- [messageformat](https://npm.io/package/messageformat.md) — 329.7K weekly downloads
- [@mintlify/scraping](https://npm.io/package/@mintlify/scraping.md) — 294.8K weekly downloads
- [@mintlify/previewing](https://npm.io/package/@mintlify/previewing.md) — 209.5K weekly downloads
- [@mintlify/prebuild](https://npm.io/package/@mintlify/prebuild.md) — 209.5K weekly downloads
- [@mintlify/link-rot](https://npm.io/package/@mintlify/link-rot.md) — 206.3K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2025-04-05
- 2.1.0 — 2024-08-15
- 2.0.1 — 2023-11-21
- 2.0.0 — 2023-11-17
- 1.7.0 — 2023-10-16
- 1.6.1 — 2023-03-19
- 1.6.0 — 2023-03-18
- 1.5.4 — 2023-01-30
- 1.5.3 — 2023-01-13
- 1.5.2 — 2022-12-01
- 1.5.1 — 2022-11-29
- 1.5.0 — 2022-11-04
- 1.4.3 — 2022-10-17
- 1.4.2 — 2022-10-14
- 1.4.1 — 2022-09-28
- … 15 more at https://npm.io/package/@cungminh2710/pseudolocalize/versions

## README

# Pseudolocalize

![NPM](https://img.shields.io/npm/dw/@cungminh2710/pseudolocalize) [![Node.js CI](https://github.com/cungminh2710/pseudolocalize/actions/workflows/node.js.yml/badge.svg)](https://github.com/cungminh2710/pseudolocalize/actions/workflows/node.js.yml)

Pseudolocalization is the process of using mock translations to aid in the testing of UI adaption and responsiveness to localized text.

This package contains several implementations of pseudolocalizing ICU strings. Some implementations are ported from @formatjs/cli

There are three techniques to pseudolocalize text:

- Accents (for example, “Lōrêm ípsüm”): Applies accents and diacritics to some characters. Not only does this help engineers clearly identify when text is pseudolocalized, it can also help identify issues with non-latin characters, character height and vertical space, and unsupported characters.

- Encapsulation (for example, “[Lorem ipsum]”): Clearly identifies the start and end of text. This helps detect cases where text is being concatenated, truncated, or where text has been hard-coded.

- Expansion (for example, “Loongeeer iiiipsuuum”): Simulates the expansion of text as it might appear in a translation. Shorter strings can expand by as much as 300%, with longer strings generally sitting somewhere between 150% and 250%. For more information, see [the IBM/W3 guidelines](https://www.w3.org/International/articles/article-text-size/#predict).

Read more on my [Canva Engineering blog about how to localize at scale](https://canvatechblog.com/how-to-design-in-every-language-at-once-f2dd66a2780f)

## Available pseudo-locales

- `en-XA` is ported from @formatjs/cli to test with accents technique.
- `en-XB` is ported from @formatjs/cli to test with encapsulation technique.
- `en-XC` is implemented using all three techniques: accents, encapsulation and expansion.
- `en-XD` is similar to `en-XC` and friendlier to dyslexic engineers.

Given the English message `my name is {name}`

| Locale  | Message                           |
| ------- | --------------------------------- |
| `en-XA` | `ṁẏ ńâṁè íś {name}`               |
| `en-XB` | `[!! ṁẏ ńâṁṁṁè íííś !!]Minh`      |
| `en-XC` | `မြ······ṁẏ ńâṁè íś Minh······မြ` |
| `en-XD` | `မြ······mẏ nâmè ís Minh······မြ` |

- As of 1 June 2022, on NPM, `code` component in this table above will fail for this tall burmese character `မြ`

![image](https://user-images.githubusercontent.com/8063319/173707554-2b65f143-4d78-420e-a908-f5d4fc294e12.png)

## How to use

- Simple:

```javascript
import { generateENXA, prettify } from '@cungminh2710/pseudolocalize';

const input = 'my name is {name}';

console.log(prettify(generateENXA(input))); // ṁẏ ńâṁè íś {name}
```

- With `react-intl`:

Check out the examples

- [with-react-intl-next](https://github.com/cungminh2710/pseudolocalize/tree/main/examples/with-react-intl-next)

---
_Source: https://npm.io/package/@cungminh2710/pseudolocalize · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
