Skip to content

Script: SpellChecker

Samuel Plentz edited this page Jul 18, 2022 · 1 revision

Change spellchecker languages, get the currently active spellchecker language or get a list of all supported spellchecker languages.

Script

Scriptname: SpellChecker

let action    = this.mVariables[0];
let languages = this.mVariables[1];


if(action == "getAllLanguages") {
  var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"].getService(Ci.mozISpellCheckingEngine);
  return spellChecker.getDictionaryList().join(", ");
}

if(action == "getCurrentLanguage") {
  return this.mWindow.document.documentElement.getAttribute("lang");
}

if(action == "setLanguages") {
  this.mWindow.ComposeChangeLanguage(languages.split(",").map(element => element.trim()));
}
return "";

Usage

Get a list of all supported spellchecker languages: (example: en-US, de-DE, fr-FR)

[[SCRIPT=SpellChecker|getAllLanguages]]

Get the currently active spellchecker language: (example: de-DE)

[[SCRIPT=SpellChecker|getCurrentLanguage]]

Change spellchecker language to en-US:

[[SCRIPT=SpellChecker|setLanguages|en-US]]

Change spellchecker languages to en-US and de-DE:

[[SCRIPT=SpellChecker|setLanguages|en-US, de-DE]]