american-british-english-translator
v0.2.1
Published
Translate between American English and British English
Downloads
4,536
Maintainers
Readme
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:
- Words with alternative spellings ("cozy" / "cosy")
- Words with different meanings in each of the two dialects ("pants")
- 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
Analyze a file:
$ english-translate American\ Psycho.txt
Prompt:
$ english-translate
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:
- List of words having different meanings in American and British English: A-L
- List of words having different meanings in American and British English: M-Z
- Glossary of American terms not widely used in the United Kingdom
- Glossary of British terms not widely used in the United States
- Comprehensive list of American and British spelling differences