Skip to content

Commit 68d2978

Browse files
authored
TCLOUD-4214: Document new feature in Spell Checker Pro plugin to add arbitrary hunspell dictionaries (#3037)
Co-authored-by: Federico Rossi <[email protected]>
1 parent 0e7e969 commit 68d2978

File tree

2 files changed

+82
-4
lines changed

2 files changed

+82
-4
lines changed

modules/ROOT/pages/custom-dictionaries-for-tiny-spellchecker.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
[[creating-custom-dictionary-files]]
66
== Creating custom dictionary files
77

8-
One custom dictionary can be created for each language supported by the spell checker (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages]), as well as an additional "global" dictionary that contains words that are valid across all languages, such as trademarks.
8+
One custom dictionary can be created for each language already supported by the spell checker (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages]) or any arbitrary language added by additional Hunspell dictionary files included in Hunspell Dictionary Path (See xref:self-hosting-hunspell.adoc[Add Hunspell dictionaries to Spell Checker Pro]). It's also possible to define an additional "global" dictionary that contains words that are valid across all languages, such as trademarks.
99

10-
A dictionary file for a particular language must be named with the language code of the language (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages] for language codes), plus the suffix `+.txt+`: E.g. `+en.txt+`, `+en_gb.txt+`, `+fr.txt+`, `+de.txt+` etc.
10+
A custom dictionary file for a particular language must be named with the language code of the language (see xref:introduction-to-tiny-spellchecker.adoc#supported-languages[supported languages] for language code examples), plus the suffix `+.txt+`: E.g. `+en.txt+`, `+en_gb.txt+`, `+fr.txt+`, `+de.txt+` etc.
1111

1212
The "global" dictionary file for language-independent words must be called "global.txt".
1313

modules/ROOT/pages/self-hosting-hunspell.adoc

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ To add Hunspell dictionaries to a self-hosted {productname}:
2222

2323
`+hunspell-dictionaries-all.zip+`:: This package contains all the Hunspell dictionaries that the spelling service supports. You will need to ensure that their license matches your requirements.
2424

25-
Hunspell dictionaries can be downloaded from other sources, but will need to be stored in the structure shown in xref:hunspell-dictionary-storage-for-spell-checker-pro[Hunspell dictionary storage for Spell Checker Pro]. Not all Hunspell dictionary languages work with Spell Checker Pro, for a list of supported languages, see: xref:introduction-to-tiny-spellchecker.adoc#supported-languages[Spell Checker Pro plugin - Supported languages].
25+
You can remove unwanted dictionaries and their associated directories, but the file structure must be respected.
26+
Hunspell dictionaries can be downloaded from other sources, but will need to be stored in the structure shown in xref:hunspell-dictionary-storage-for-spell-checker-pro[Hunspell dictionary storage for Spell Checker Pro].
2627

2728
== Configuring the spelling service to use Hunspell dictionaries
2829

@@ -31,7 +32,81 @@ include::partial$misc/hunspell-dictionaries-path.adoc[]
3132
[[hunspell-dictionary-storage-for-spell-checker-pro]]
3233
== Hunspell dictionary storage for Spell Checker Pro
3334

34-
You can remove unwanted dictionaries and their associated directories, but the file structure must be as follows (including filenames):
35+
Each Hunspell dictionary comes in two files. The .dic file which is the list of words, and the .aff file which is a list of rules and other options. These rules tell Hunspell, for example, how to convert a word into its plural or possessive forms.
36+
These files should be named following the language tag definition described in RFC 5646, using "-" or "_" as separator.
37+
38+
There are two file structures available for storing Hunspell dictionaries.
39+
40+
=== Flat structure
41+
42+
[source,pre]
43+
----
44+
├── af_ZA.aff
45+
├── af_ZA.dic
46+
├── af_ZA.license
47+
├── da.aff
48+
├── da.dic
49+
├── da.license
50+
├── de_DE.aff
51+
├── de_DE.dic
52+
├── de_DE.license
53+
├── en_AU.aff
54+
├── en_AU.dic
55+
├── en_AU.license
56+
├── en_CA.aff
57+
├── en_CA.dic
58+
├── en_CA.license
59+
├── en_GB.aff
60+
├── en_GB.dic
61+
├── en_GB.license
62+
├── en_medical.aff
63+
├── en_medical.dic
64+
├── en_medical.license
65+
├── en_US.aff
66+
├── en_US.dic
67+
├── en_US.license
68+
├── es.aff
69+
├── es.dic
70+
├── es.license
71+
├── fr.aff
72+
├── fr.dic
73+
├── fr.license
74+
├── hu.aff
75+
├── hu.dic
76+
├── hu.license
77+
├── it_IT.aff
78+
├── it_IT.dic
79+
├── it_IT.license
80+
├── mi_NZ.aff
81+
├── mi_NZ.dic
82+
├── mi_NZ.license
83+
├── nb_NO.aff
84+
├── nb_NO.dic
85+
├── nb_NO.license
86+
├── nl_NL.aff
87+
├── nl_NL.dic
88+
├── nl_NL.license
89+
├── nn.aff
90+
├── nn.dic
91+
├── nn.license
92+
├── pl.aff
93+
├── pl.dic
94+
├── pl.license
95+
├── pt_BR.aff
96+
├── pt_BR.dic
97+
├── pt_BR.license
98+
├── pt_PT.aff
99+
├── pt_PT.dic
100+
├── pt_PT.license
101+
├── sv_FI.aff
102+
│── sv_FI.dic
103+
├── sv_FI.license
104+
├── sv_SE.aff
105+
├── sv_SE.dic
106+
└── sv_SE.license
107+
----
108+
109+
=== Nested structure
35110

36111
[source,pre]
37112
----
@@ -121,6 +196,9 @@ You can remove unwanted dictionaries and their associated directories, but the f
121196
└── sv_SE.dic
122197
----
123198

199+
Both structures may be used at the same time. If you provide dictionary files for the same language tag in both ways, Spell Checker Pro will try to load the nested dictionary files first. If they're not correct, then flat structured files will be loaded.
200+
201+
124202
=== Missing Dictionaries
125203

126204
Where a Hunspell dictionary has not been provided, the spelling service will fallback to the built-in dictionaries for supported languages. For a list of supported Spell Checker languages, see: xref:introduction-to-tiny-spellchecker.adoc#spellchecker_languages[Spell Checker Pro plugin - Supported languages].

0 commit comments

Comments
 (0)