User

User

Class representing a user. A User has dictionaries, spelling instances, and custom/own words.

Constructor

new User(dictionaries, languages, ownWords)

Create a User
Source:
Parameters:
Name Type Description
dictionaries Array.<object> array of dictionary objects
languages Array.<string> array of five digit language codes
ownWords Array.<object> array of user saved custom word objects

Members

dicts

Gets the user's dictionaries
Source:

langs

Gets the user's languages. These are ordered by language preference.
Source:

spellers

Gets the user's nspell (Speller) instances
Source:
See:

Methods

addWord(word)

Adds a word to user's custom/own words and updates existing spellchecker instances
Source:
Parameters:
Name Type Description
word string word string to be added

getPreferredLanguage(contentLanguage) → {string}

Gets the user's preferred (or default) language when spell checking content
Source:
See:
Parameters:
Name Type Description
contentLanguage string two character length locale i.e. 'de' or 'au'
Returns:
Type:
string
- a five character length language code i.e. 'en-au' or 'de-de'

removeWord(word)

Removes a word from user's custom/own words and updates existing spellchecker instances
Source:
Parameters:
Name Type Description
word string word string to be removed

setPreferredLanguageOrder(languages)

Sets the preferred language order of a user based on a sorted array of languages
Source:
Parameters:
Name Type Description
languages Array.<string> array of language codes i.e. ['de-de', 'en-au']