- Description:
-
Users can choose to have spell-checking feature or not.
If either the site or the account choose not to have the feature, the checking will be omitted. Languages for the checking language can be picked for the site. ~ (The list should be improve to change with the installation on the server machine) ~ (The list should be improved later to change with the installation on the server machine)
Options for spell checking
Review Request #2160 — Created Feb. 25, 2011 and discarded
Users can choose to have spell-checking feature or not. If either the site or the account choose not to have the feature, the checking will be omitted. Languages for the checking language can be picked for the site. (The list should be improved later to change with the installation on the server machine)
DO
-
-
I think you can do: if parse_version(enchant.__version__) >= parse_version("1.6.5"): You'll need to import parse_version near the top: from pkg_resources import parse_version.
-
-
-
It'd actually be nice to pull all the required version parts out into one place so we only have a single place to update the version we need. Same with the checks above.
-
-
I think what I'd prefer is that in the import above, you set has_spell_checking to True or False based on whether the import succeeded, and then create LANGUAGE_CHOICES conditionally based on that. Also, no space between the opening parens.
-
This will fail if spell checking isn't available. We may need to set LANGUAGE_CHOICES above to an empty tuple if we don't have spell checking.
-
-
So this is kind of an interesting issue. If the user changes the language, this code won't know about it. It'll keep using the old one. We need to therefore have this somewhat conditional. So what I'd suggest is storing spell_checker and language as variables, but default them to None. Then when you need to use spell_checker, compare the current language set in siteconfig to the last stored one. If it changed, replace spell_checker.
-