
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
pseudo-localization
Advanced tools
Inspired by pseudo-localization at Netflix and Firefox.
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.
English | Pseudo Language |
---|---|
![]() | ![]() |
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.
Pseudo-localization helps detect issues such as:
npm install pseudo-localization
Copy the files from src
and use them directly.
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.
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>;
}
Pseudo-localization supports two strategies:
accented
)Expands text and replaces Latin letters with accented Unicode counterparts.
pseudoLocalization.start({ strategy: 'accented' });
Example output: Ȧȧƈƈḗḗƞŧḗḗḓ Ḗḗƞɠŀīīşħ
bidi
)Simulates an RTL language by reversing words and using right-to-left Unicode formatting.
pseudoLocalization.start({ strategy: 'bidi' });
Example output: ɥsıʅƃuƎ ıpıԐ
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
).A command-line interface (CLI) is available for quick testing and automation.
npx pseudo-localization "hello world"
pseudo-localization [src] [options]
Positionals:
src Input string
Options:
--strategy Localization strategy (accented or bidi)
--help Show help
Works in all modern browsers.
By using pseudo-localization, you can catch UI issues early, ensuring your app is truly localization-ready!
FAQs
pseudo-localization for internationalization testing
The npm package pseudo-localization receives a total of 23,883 weekly downloads. As such, pseudo-localization popularity was classified as popular.
We found that pseudo-localization demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.