TinyMCE 拼写检查器支持 Hunspell 词典。Hunspell 词典可从多个来源获取,但文件必须存储为特定结构才能与 TinyMCE 拼写检查器配合使用。Tiny 提供具有所需结构的可下载捆绑包。
要将 Hunspell 词典添加到自托管的 TinyMCE:
下载最新的 TinyMCE Enterprise 包。
下载所需的 Hunspell 词典。
配置 TinyMCE 拼写服务以使用 Hunspell 词典。
可下载的 Hunspell 捆绑包
Tiny 提供两个可下载的 Hunspell 词典捆绑包。请从 Tiny 账户 > 下载 下载这些捆绑包。
hunspell-dictionaries-approved.zip不包含以下许可的词典:
hunspell-dictionaries-all.zip此包包含拼写服务支持的所有 Hunspell 词典。您需要确保其许可符合您的要求。
您可以删除不需要的词典及其关联目录,但必须遵守文件结构。Hunspell 词典可从其他来源下载,但需要按照“拼写检查器的 Hunspell 词典存储”中所示的结构进行存储。
配置拼写服务以使用 Hunspell 词典
ephox.spelling.hunspell-dictionaries-path 设置用于定义 Hunspell 词典的位置。如果未提供此设置,则不支持 Hunspell 词典。
要求:
包含 Hunspell 词典的目录必须符合“拼写检查器的 Hunspell 词典存储”中定义的文件结构。
包含 Hunspell 词典的目录必须在容器中挂载为卷。
Tiny 建议将 Hunspell 词典存储在类似于 application.conf 文件的位置。例如,如果 application.conf 位于名为 /opt/ephox 的目录中,则 Hunspell 词典应存储在子目录 /opt/ephox/hunspell-dictionaries 中。
示例:
ephox {
spelling {
hunspell-dictionaries-path: "/opt/ephox/hunspell-dictionaries"
}
}拼写检查器的 Hunspell 词典存储
每个 Hunspell 词典由两个文件组成。.dic 文件是单词列表,.aff 文件是规则和选项列表。这些规则告诉 Hunspell 如何将单词转换为复数或所有格形式等。这些文件的命名应遵循 RFC 5646 中描述的语言标签定义,使用 "-" 或 "_" 作为分隔符。
有两种可用于存储 Hunspell 词典的文件结构。
扁平结构
├── af_ZA.aff ├── af_ZA.dic ├── af_ZA.license ├── da.aff ├── da.dic ├── da.license ├── de_DE.aff ├── de_DE.dic ├── de_DE.license ├── en_AU.aff ├── en_AU.dic ├── en_AU.license ├── en_CA.aff ├── en_CA.dic ├── en_CA.license ├── en_GB.aff ├── en_GB.dic ├── en_GB.license ├── en_medical.aff ├── en_medical.dic ├── en_medical.license ├── en_US.aff ├── en_US.dic ├── en_US.license ├── es.aff ├── es.dic ├── es.license ├── fr.aff ├── fr.dic ├── fr.license ├── hu.aff ├── hu.dic ├── hu.license ├── it_IT.aff ├── it_IT.dic ├── it_IT.license ├── mi_NZ.aff ├── mi_NZ.dic ├── mi_NZ.license ├── nb_NO.aff ├── nb_NO.dic ├── nb_NO.license ├── nl_NL.aff ├── nl_NL.dic ├── nl_NL.license ├── nn.aff ├── nn.dic ├── nn.license ├── pl.aff ├── pl.dic ├── pl.license ├── pt_BR.aff ├── pt_BR.dic ├── pt_BR.license ├── pt_PT.aff ├── pt_PT.dic ├── pt_PT.license ├── sv_FI.aff │── sv_FI.dic ├── sv_FI.license ├── sv_SE.aff ├── sv_SE.dic └── sv_SE.license
嵌套结构
├── af_ZA
│ ├── af_ZA.aff
│ ├── af_ZA.dic
│ └── license
├── da
│ ├── da.aff
│ ├── da.dic
│ └── license
├── de_DE
│ ├── de_DE.aff
│ ├── de_DE.dic
│ └── license
├── en_AU
│ ├── en_AU.aff
│ ├── en_AU.dic
│ └── license
├── en_CA
│ ├── en_CA.aff
│ ├── en_CA.dic
│ └── license
├── en_GB
│ ├── en_GB.aff
│ ├── en_GB.dic
│ └── license
├── en_medical
│ ├── en_medical.aff
│ ├── en_medical.dic
│ └── license
├── en_US
│ ├── en_US.aff
│ ├── en_US.dic
│ └── license
├── es
│ ├── es.aff
│ ├── es.dic
│ └── license
├── fr
│ ├── fr.aff
│ ├── fr.dic
│ └── license
├── hu
│ ├── hu.aff
│ ├── hu.dic
│ └── license
├── it_IT
│ ├── it_IT.aff
│ ├── it_IT.dic
│ └── license
├── mi_NZ
│ ├── license
│ ├── mi_NZ.aff
│ └── mi_NZ.dic
├── nb_NO
│ ├── license
│ ├── nb_NO.aff
│ └── nb_NO.dic
├── nl_NL
│ ├── license
│ ├── nl_NL.aff
│ └── nl_NL.dic
├── nn
│ ├── license
│ ├── nn.aff
│ └── nn.dic
├── pl
│ ├── license
│ ├── pl.aff
│ └── pl.dic
├── pt_BR
│ ├── license
│ ├── pt_BR.aff
│ └── pt_BR.dic
├── pt_PT
│ ├── license
│ ├── pt_PT.aff
│ └── pt_PT.dic
├── sv_FI
│ ├── license
│ ├── sv_FI.aff
│ └── sv_FI.dic
└── sv_SE
├── license
├── sv_SE.aff
└── sv_SE.dic这两种结构可以同时使用。如果您以两种方式提供同一语言标签的词典文件,拼写检查器将尝试先加载嵌套的词典文件。如果它们不正确,则将加载扁平结构的文件。
缺失的词典
如果未提供 Hunspell 词典,拼写服务将回退到受支持语言的内置词典。有关支持的拼写检查器语言列表,请参阅:拼写检查器插件 - 支持的语言.