ENCHANT(5)
๐ NAME ๐
okay so bestie, this page is all about Enchant โ the language tags, the ordering files, and the personal word lists. That's the whole vibe. โจ
Basically: enchant language tags, ordering files and personal word lists. Slay.
๐ฆ LANGUAGE TAGS ๐ฆ
So Enchant figures out which dictionaries are which by their language tag. A language tag is typically an IETF BCP 47 language tag shaped like LANGUAGE_COUNTRY โ for example en_US or zh_SG. Iconic format, no notes.
And the way that you can stack multiple dictionaries together?? Literally just give a comma-separated list, like en_GB,fr_FR. Chef's kiss. This is super useful for checking multi-lingual text, or for using specialised word lists for a particular subject, project or document โ those might have names such as en-medical or en-my-novel. ๐
๐ธ ORDERING FILE ๐ธ
Enchant uses global and per-user ordering files named enchant.ordering to decide which spelling provider to use for particular languages. Heads up: the per-user file takes precedence. ๐
The ordering file takes the form language_tag:<comma-separated list of spelling providers>. Wanna see what dictionaries are available? Run enchant-lsmod-2. And '*' means "use this ordering for all languages, unless instructed otherwise." For example:
*:aspell,hunspell,nuspell
en:aspell,hunspell,nuspell
en_GB:hunspell,nuspell,aspell
fr:hunspell,nuspell,aspell
๐ PERSONAL WORD LISTS ๐
Personal word lists are simple plain text files with one word per line. The name of the file starts with the language tag and ends .dic. And every personal word list has a corresponding exclude file ending in .exc, which lists words that are found in the dictionary but that the user wants to be considered invalid. ๐
These files are stored in an Enchant configuration directory โ peep FILES AND DIRECTORIES below for the deets. Oh, and lines starting with a hash sign '#' are ignored. ๐ซถ
๐ SHARING PERSONAL WORD LISTS BETWEEN SPELL-CHECKERS ๐
Okay so this is possible, and usually safe: you can share Enchant's personal word lists with other spelling checkers that use the same format. โ ๏ธ Note that other spell-checkers may not support comments! The spell-checkers known to be compatible are Hunspell, Nuspell and Ispell. (And yes โ although Enchant does not support Ispell as a provider, it's still fine to share word lists with it.) Other spell-checkers supported by Enchant are either incompatible, or have no personal word list mechanism. And honestly there may well be yet other spell-checkers, unknown to Enchant, that use the same format. The lore runs deep. ๐ง
Some applications use Hunspell or Nuspell, but store the personal word list under another name or in another location โ Firefox and Thunderbird do this. Firefox also seems to reorder its word list when updating it; again, this is OK, as the result is still in the same format. ๐
So to share word lists with Enchant: find the other spelling checker's word list file, e.g. ~/.hunspell_fr_FR or ~/.config/nuspell/fr_FR, and merge it with the corresponding Enchant file โ in this case ~/.config/enchant/fr_FR.dic. Use the following command, replacing ENCHANT-DICT and OTHER-DICT with the corresponding dictionary file names:
cat ENCHANT-DICT OTHER-DICT | sort -u > merged.txt
Take a look at merged.txt to check the merge has worked, then
mv merged.txt ENCHANT-DICT
rm OTHER-DICT
ln -s OTHER-DICT ENCHANT-DICT
to replace the other dictionary file with a link to the Enchant dictionary โ again, filling in the name of the dictionary files. Boom. Merged. โจ๐ฅ
๐ ENVIRONMENT ๐
The following variables affect the behavior of Enchant:
ENCHANT_CONFIG_DIRโ a directory in which Enchant should look for configuration files. See below. ๐G_MESSAGES_DEBUGโ Enchant uses GLib's log functions, with the domainlibenchant, to output messages useful for debugging. SettingG_MESSAGES_DEBUGtolibenchantwill cause Enchant to output debugging messages to standard error. See the GLib documentation for more details. ๐
๐ FILES AND DIRECTORIES ๐
Enchant looks in the following places for user files, in decreasing order of precedence:
ENCHANT_CONFIG_DIRโ (if the environment variable is set.)XDG_CONFIG_HOME/enchant(non-Windows systems) โ default:~/.config/enchantCSIDL_LOCAL_APPDATA\enchant(Windows systems) โ default:C:\Documents and Settings\username\Local Settings\Application Data\enchant
Dictionaries for some providers are looked for in a subdirectory with the same name as the provider, for example ~/.config/enchant/hunspell. Currently this works for Hspell, Hunspell, Nuspell and Voikko. โญ
Providers also look in specific system directories, and in some cases and user directories, for their dictionaries; see the documentation for each provider. (Not me telling you to go read more docs, but likeโฆ go read the docs. ๐ญ)
In addition, Enchant looks in the following systems directories for ordering files:
/etc/enchant-2โ (or the equivalent location relative to the enchant library for a relocatable build.)/usr/share/enchant-2โ (or the equivalent location relative to the enchant library for a relocatable build.)
๐ SEE ALSO ๐
๐ AUTHOR ๐
Written by Dom Lachowicz and Reuben Thomas. Legends, honestly. ๐ซถ
and that's the whole page, bestie โ ENCHANT(5), File Formats Manual, in all her glory. go forth and spell-check responsibly. ๐โจ
๐ฆ where this page comes from
- arch rolling: enchant 2.8.21-1 ยท LGPL-2.1-or-later
- debian trixie: enchant-2 2.8.2+dfsg1-3 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: enchant-tools 2.8.2-160000.2.2 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: enchant-tools 2.8.2-160000.2.2 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: enchant-tools 2.8.2-160000.2.2 ยท LGPL-2.1-or-later
- opensuse-leap 16.0: enchant-tools 2.8.2-160000.2.2 ยท LGPL-2.1-or-later
- ubuntu questing: enchant-2 2.8.2+dfsg1-3
- ubuntu resolute: enchant-2 2.8.2+dfsg1-3build1 ยท LGPL-2.1-or-later
- ubuntu stonking: enchant 2.8.16+dfsg-4 ยท LGPL-2.1-or-later
- Copyright (C) 2022-2024 Reuben Thomas
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms