Skip to main content

Spellchecker

What it does

This plugin adds spellcheck functionality to Xeditor. It uses Hunspell dictionaries and is based on language tools.

Spell Checker

Installation

First you have to switch into your project location using the command line.

cd path/to/your/project

Now you should be in the same directory as the package.json file. Then you can install the plugin as follows:

npm install @xeditor/plugin-spellchecker --save --registry https://npm.xeditor.com:4873

Configuration

The demo configuration of the plugin looks like this:

{
pluginId: 'spellchecker',
ptype: 'uxxeditorspellchecker',
spellCheckerURL: '/editor/spellchecker'
}

API

The API for the plugin can be found here

Buttons

This plugin exports the following button templates that can be used in your toolbar configuration:

NameFunction
button:xeditor.spellchecker.configureOpens spell check language configuration window
button:xeditor.spellchecker.checkToggles spell check

Spellcheck Server

Description

The spellcheck server is a server implementation using the JLanguageTools. By using JLanguageTools over 46 languages can be provided.

Setup & Configuration

For the use of the Spellcheck Server we recommend the use of Docker. The following docker-compose.yml can be used for this:

docker-compose.yml (see Available environment variables for configuration):

version: '3'
services:
spellcheck:
image: "xpublisher/spellcheck:stable"
ports:
- '0.0.0.0:8080:8080'
environment:
- spellcheck.auth.username=user
- spellcheck.auth.password=password
- spellcheck.auth.token=token
- spellcheck.languages=de-DE,en-US
- spellcheck.language.de-DE.init=eager
- spellcheck.language.de-DE.min=10
- spellcheck.language.de-DE.max=50
- spellcheck.language.de-DE.wait=8000
- JAVA_OPTS=-Xms512m -Xmx1024m

Note: Running the spellchecker as native executable is also possible

Run following command in the project folder (see Available environment variables for configuration)

./gradlew build -Dquarkus.package.type=native \
-Dquarkus.native.container-build=true \
-Dspellcheck.auth.username=[YOUR_USERNAME] \
-Dspellcheck.auth.username=[YOUR_PASSWORD] \
-Dspellcheck.auth.username=[YOUR_TOKEN]

Available environment variables

Application

NameDefaultDescription
spellcheck.auth.username""Name of the user to be used for http authentication.required
spellcheck.auth.password""Password of the user to be used for http authentication.required
spellcheck.auth.token""Password of the user to be used for http authentication. The username is completely ignored.required
spellcheck.languages""List of activated language short names. These can be separated by a comma. If no language is configured, all languages are automatically active.
spellcheck.language.default.init"lazy"Enables lazy or eager loading. With eager loading the language pool is activated at startup. This increases the startup time, but reduces the reaction time of the first request.
spellcheck.language.default.min5Minimum number of pool items that are kept for the language check.
spellcheck.language.default.max30Maximum number of pool items that are kept for the language check.
spellcheck.language.default.wait10000Maximum length in milliseconds that a single check may take.
spellcheck.language.<?>.init"lazy"Enables lazy or eager loading. With eager loading the language pool is activated at startup. This increases the startup time, but reduces the reaction time of the first request.
spellcheck.language.<?>.min5Minimum number of pool items that are kept for the language check.
spellcheck.language.<?>.max30Maximum number of pool items that are kept for the language check.
spellcheck.language.<?>.wait10000Maximum length in milliseconds that a single check may take.

Replace <?> with the short name of any activated language

Other

NameDefaultDescription
JAVA_OPTS""JVM Options

Supported languages

ShortNameName
arArabic
ast-ESAsturian
be-BYBelarusian
br-FRBreton
ca-ESCatalan
ca-ES-valenciaCatalan (Valencian)
zh-CNChinese
da-DKDanish
nlDutch
nl-BEDutch (Belgium)
enEnglish
en-AUEnglish (Australian)
en-CAEnglish (Canadian)
en-GBEnglish (GB)
en-NZEnglish (New Zealand)
en-ZAEnglish (South African)
en-USEnglish (US)
eoEsperanto
frFrench
gl-ESGalician
deGerman
de-ATGerman (Austria)
de-DEGerman (Germany)
de-CHGerman (Swiss)
el-GRGreek
ga-IEIrish
itItalian
ja-JPJapanese
km-KHKhmer
faPersian
pl-PLPolish
ptPortuguese
pt-AOPortuguese (Angola preAO)
pt-BRPortuguese (Brazil)
pt-MZPortuguese (Moçambique preAO)
pt-PTPortuguese (Portugal)
ro-RORomanian
ru-RURussian
de-DE-x-simple-languageSimple German
sk-SKSlovak
sl-SISlovenian
esSpanish
es-ARSpanish (voseo)
svSwedish
tl-PHTagalog
ta-INTamil
uk-UAUkrainian

Interface / Connectivity

You can find you a swagger documentation about the endpoints here.

Development

For the development of the project we recommend VSCode with the recommended plugins (Extensions -> Recommended Extensions).

First you have to download the project: git clone https://bitbucket.org/xpublisher/spellcheck

Afterwards you can simply build and start the container using: sudo docker-compose up --build

This will now start the spellceck server and map it to your local port 8080.

Authentication

Authentication for each endpoint is required and is different from the two api versions.

Api V1

MethodExample
Queryparameter/v1/getlanguages?username=[YOUR_USERNAME]&passwort=[YOUR_PASSWORD]
Headerparameterusername=[YOUR_USERNAME], password=[YOUR_PASSWORD]
Basic AuthBasic [YOUR_USERNAME]:[YOUR_PASSWORT] (Base64 encoded)

Note: V1 supports the use of a token instead of username and password.

Api V2

MethodExample
Basic AuthBasic [YOUR_USERNAME]:[YOUR_PASSWORT] (Base64 encoded)

Note: V2 only supports the use of username and password as Basic Auth. Switching the username and password for token is not supported.

License

Copyright (C) Xpublisher GmbH - All Rights Reserved Unauthorized copying, usage or reading of any files, via any medium is strictly prohibited Proprietary and confidential