New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pseudo-localization

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pseudo-localization - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

lib/pseudoLocalizeString.js

3

CHANGELOG.md

@@ -0,1 +1,4 @@

##2.1.0
- Adding CLI interface
##2.0.2

@@ -2,0 +5,0 @@ - Fix a bug where blacklisted nodes would get pseudo-localized when mutated in the DOM

25

package.json
{
"name": "pseudo-localization",
"version": "2.0.2",
"version": "2.1.0",
"description": "Dynamic pseudo-localization in the browser and nodejs",

@@ -9,6 +9,10 @@ "main": "lib/index.js",

],
"bin": "./bin/pseudo-localize",
"scripts": {
"start": "node devserver.js",
"prepare": "babel src --out-dir lib --minified --no-comments --source-maps",
"test": "echo \"Error: no test specified\" && exit 1"
"prepare": "babel src --out-dir lib --minified --no-comments --source-maps --ignore '**/*.test.js'",
"check-formatting": "prettier --list-different src/**/*.js",
"lint": "eslint src/**/*.js",
"test-js": "jest src/*",
"test": "npm run test-js jest && npm run check-formatting && npm run lint"
},

@@ -33,7 +37,14 @@ "author": "Tryggvi Gylfason (http://twitter.com/tryggvigy)",

"devDependencies": {
"@babel/cli": "7.2.3",
"@babel/core": "7.3.3",
"@babel/preset-env": "7.3.1"
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babel-jest": "^24.8.0",
"eslint": "^6.1.0",
"jest-cli": "^24.8.0",
"prettier": "^1.18.2"
},
"dependencies": {}
"dependencies": {
"get-stdin": "^7.0.0",
"yargs": "^13.3.0"
}
}

@@ -11,2 +11,4 @@ <sub>Inspired by pseudo-localization at [Netflix](https://medium.com/netflix-techblog/pseudo-localization-netflix-12fff76fbcbe) and [Firefox](https://reviewboard.mozilla.org/r/248606/diff/2#index_header)</sub>

[![Edit pseudo-localization-react](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/1q7n08or4j)
`pseudo-localization` is a script that performs [pseudolocalization](https://en.wikipedia.org/wiki/Pseudolocalization) against the DOM or individual strings.

@@ -74,2 +76,30 @@

Using hooks? Here's an example:
```jsx
import React from 'react';
import pseudoLocalization from 'pseudo-localization';
function PseudoLocalization() {
React.useEffect(() => {
pseudoLocalization.start();
return () => {
pseudoLocalization.stop()
};
}, []);
}
// And use it
function Page() {
return (
<main>
<PseudoLocalization />
<h1>I will get pseudo localized along with everything else under document.body!</h1>
<main>
);
}
```
You can also call the underlying `localize` function to pseudo-localize any string. This is useful for non-browser environments like nodejs.

@@ -173,4 +203,44 @@

## CLI Interface
For easy scripting a CLI interface is exposed. The interface supports raw input, JSON files, and CommonJS modules.
```bash
npx pseudo-localize ./path/to/file.json
# pass in a JS transpiled ES module or an exported CJS module
npx pseudo-localize ./path/to/file
# pass in JSON files through STDIN
cat ./path/to/file.json | npx pseudo-localize --strategy bidi
# pass a string via a pipe
echo hello world | npx pseudo-localize
# direct input pseudo-localization
npx pseudo-localize -i "hello world"
```
CLI Options:
```
pseudo-localize [src] [options]
Pseudo localize a string, JSON file, or a JavaScript object
Positionals:
src The source as a path or from STDIN [string]
Options:
-o, --output Writes output to STDOUT by default. Optionally specify a JSON
file to write the pseudo-localizations to [string]
-i, --input Pass in direct input to pseudo-localize [string]
--debug Print out all stack traces and other debug info [boolean]
--pretty Pretty print JSON output [boolean]
--strategy Set the strategy for localization
[choices: "accented", "bidi"] [default: "accented"]
--help Show help [boolean]
--version Show version number [boolean]
```
## Support
Works in all evergreen browsers.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc