In order to support parallel spell checking of German old and new spelling (something I need desperately), I had to implement support for aspell language varieties.
A variety is, well, a variety of a given language for which a separate dictionary exists. Aspell's naming convention is lang[_REGION]-variety, e.g. de-alt (for old German spelling) or en_GB-ize (for British -ize spelling). For this, the "variety" tag needs to be set. The attached patch does this and corrects the entry for old German spelling. The patch is intended both for branch and trunk. Objections? Jürgen
Index: src/ASpell.cpp =================================================================== --- src/ASpell.cpp (Revision 33078) +++ src/ASpell.cpp (Arbeitskopie) @@ -20,6 +20,7 @@ #include "WordLangTuple.h" #include "support/lassert.h" +#include "support/lstrings.h" using namespace std; @@ -56,8 +57,14 @@ void ASpell::addSpeller(string const & lang) { AspellConfig * config = new_aspell_config(); - // FIXME The aspell documentation says to use "lang" - aspell_config_replace(config, "language-tag", lang.c_str()); + string real_lang; + // Aspell supports both languages and varieties (such as German + // old vs. new spelling). The respective naming convention is + // lang_REGION-variety (e.g. de_DE-alt); so check for a variety: + string const variety = support::split(lang, real_lang, '-'); + aspell_config_replace(config, "lang", real_lang.c_str()); + if (!variety.empty()) + aspell_config_replace(config, "variety", variety.c_str()); // Set the encoding to utf-8. // aspell does also understand "ucs-4", so we would not need a // conversion in theory, but if this is used it expects all Index: lib/languages =================================================================== --- lib/languages (Revision 33078) +++ lib/languages (Arbeitskopie) @@ -39,7 +39,7 @@ # We redefine \og and \fg (guillemets) for older french language definitions french french "French" false iso8859-15 fr_FR "\addto\extrasfrench{\providecommand{\og}{\leavevmode\flqq~}\providecommand{\fg}{\ifdim\lastskip>\...@\unskip\fi~\frqq}}" galician galician "Galician" false iso8859-15 gl_ES "" -german german "German (old spelling)" false iso8859-15 de_DE "" +german german "German (old spelling)" false iso8859-15 de-alt "" ngerman ngerman "German" false iso8859-15 de_DE "" greek greek "Greek" false iso8859-7 el_GR "" polutonikogreek polutonikogreek "Greek (polytonic)" false iso8859-7 el_GR "\providecommand*{\perispomeni}{\char126}\addto\extraspolutonikogreek{\let\~\perispomeni}\addto\extrasgreek{\let\~\perispomeni}"