American British English Translator

Now online at: https://codewordsolver.com/american-british-english-translator

Reads in a text and identifies words that differ in usage between American English and British English, including:

  1. Words with alternative spellings ("cozy" / "cosy")
  2. Words with different meanings in each of the two dialects ("pants")
  3. Words typically used in only one of the dialects ("ladybug" / "ladybird")

Existing solutions only notice the first category of words, thus failing to prevent the most embarrassing mistakes, such as a British person asking an American colleague for a "rubber".

Installation

$ npm install -g american-british-english-translator

This will install the command english-translate globally, so it will be added automatically to your PATH.

Usage (CLI)

The command line interface can be used in three different ways:

Pipe stdin:

$ echo "That was a right bodge job" | english-translate

Example 2

Analyze a file:

$ english-translate American\ Psycho.txt

Example 1

Prompt:

$ english-translate

Example 3

Command line options

By default english-translate outputs almost everything it can*, but it's possible to refine the output and thus speed up the program by using some command line options:

# Only identify Americanisms
$ english-translate file.txt --american

# Only identify Britishisms
$ english-translate --british

# Only check for spelling differences
$ english-translate --spelling

# Only check for British spellings
$ english-translate --british --spelling

# Don't check spelling differences or different meanings, only check for meanings exclusive to one of the dialects
$ english-translate --exclusive

# Print only the first instance of any identified words
$ english-translate --firstonly

# Do not use colors
$ english-translate --no-color
  • Common words with tiny subtleties in meaning, such as 'can' or 'through', are ignored by default. These words are configured in data/ignore_list.json. If you want to include them then pass the --showall flag.

Usage (from Node.js)

Include it in your script and call the translate() method:

var translator = require('american-british-english-translator');

var data = "I was gobsmacked";

var options = {
  british: true
};

console.log(JSON.stringify(translator.translate(data, options)));

Sources

Uses modified versions of the following lists: