npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

pseudo-localization

v3.1.1

Published

pseudo-localization for internationalization testing

Readme

Inspired by pseudo-localization at Netflix and Firefox.

Pseudo-Localization

Pseudo-localization helps developers test UI elements for localization issues before actual translations are available. This package transforms text into a pseudo-language to simulate real-world localization challenges.

Preview

| English | Pseudo Language | | ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | English example | Pseudo-localized example |

Live Demo

See it in action on https://tryggvigy.github.io/pseudo-localization/hamlet.html

Changes to the DOM trigger pseudo-localization in real time. Try modifying text nodes or adding/removing elements via DevTools.


Why Use This?

Pseudo-localization helps detect issues such as:

  • Text Overflow – Translations are often longer than the original text, which may cause UI breaking.
  • Font Rendering – Certain languages have larger glyphs or diacritics that may be cut off.
  • Right-to-Left (RTL) Support – Ensures proper layout handling for RTL languages.
  • Hardcoded Strings – Identifies untranslated or hardcoded text that should be localized.

Installation

Via npm

npm install pseudo-localization

Copy The Source Code

Copy the files from src and use them directly.


Usage

pseudoLocalizeString

Transform individual strings:

import { pseudoLocalizeString } from 'pseudo-localization';

console.log(pseudoLocalizeString('hello')); // ħḗḗŀŀǿǿ
console.log(pseudoLocalizeString('hello', { strategy: 'bidi' })); // oʅʅǝɥ

Use-case: Ensure text is passing through a translation function.

import translate from './my-translation-lib';
const _ = (key) => pseudoLocalizeString(translate(key, navigator.language));

console.log(_('Some Localized Text')); // Şǿǿḿḗḗ Ŀǿǿƈȧȧŀīẑḗḗḓ Ŧḗḗẋŧ

pseudo-localization/dom

Automatically localize the entire page or parts of the DOM.

React Example

import React, { useEffect } from 'react';
import { PseudoLocalizeDom } from 'pseudo-localization/dom';

function Page() {
  useEffect(() => PseudoLocalizeDom.start(), []);
  return <h1>This text will be pseudo-localized!</h1>;
}

Strategies

Pseudo-localization supports two strategies:

1. Accented (accented)

Expands text and replaces Latin letters with accented Unicode counterparts.

pseudoLocalization.start({ strategy: 'accented' });

Example output: Ȧȧƈƈḗḗƞŧḗḗḓ Ḗḗƞɠŀīīşħ

Accented example


2. Bidirectional (bidi)

Simulates an RTL language by reversing words and using right-to-left Unicode formatting.

pseudoLocalization.start({ strategy: 'bidi' });

Example output: ɥsıʅƃuƎ ıpıԐ

Bidi example


API Reference

pseudoLocalizeString(str: string, options?: Options): string

  • str: String to localize.
  • options.strategy: 'accented' (default) or 'bidi'.

PseudoLocalizeDom.start(options?: DomOptions): StopFn

Pseudo-localizes the page and watches for DOM changes.

import { PseudoLocalizeDom } from 'pseudo-localization/dom';
const stop = new PseudoLocalizeDom().start();
// Stop pseudo-localization later
stop();

DomOptions

  • strategy: 'accented' or 'bidi'.
  • blacklistedNodeNames: Nodes to ignore (default: ['STYLE']).
  • root: Root element for localization (default: document.body).

CLI Usage

A command-line interface (CLI) is available for quick testing and automation.

npx pseudo-localization "hello world"

CLI Options

pseudo-localization [src] [options]

Positionals:
  src  Input string

Options:
  --strategy    Localization strategy (accented or bidi)
  --help        Show help

Browser Compatibility

Works in all modern browsers.


By using pseudo-localization, you can catch UI issues early, ensuring your app is truly localization-ready!