I often need to write documents using two languages *. I might mark the document as one written in English, and then mark specific areas written in two other languages. The current stable lyx allows me to alter the language, which the spell-checker uses to check my document (rather annoyingly -- I have to go to preferences and find the right tab, and type the language name). This is a problem, for two reasons.

* It's conceivable that I might even need 3 -- that begs the question of how I'm to display, say, both Russian and French at the same time, since French accented letters overlap with the Russian character set, If someone knows the answer, please tell me.

Firstly, both aspell and ispell are kind of dumb, and will mark words in languages other than the current as misspelled (ispell is a tiny bit better about it). However, it's not really their fault, since they have no way of knowing the language -- all the ASCII characters are shared out among many languages (I have no clue what the situation is with truly multibyte languages like Chinese, Korean, and Japanese.) Secondly, the UI for switching spell-checking languages is atrocious.

Therefore, I think it should be up to LyX to do spell checking in an intelligent manner. I see several approaches. One is to implement dynamic spell checking a la Word, and use that for single-pass spell checking as well. Here's how I would go about doing that:

LyX knows how many languages I'm using in my document (it can count easily and at no cost -- just watch what I mark/unmark). For every language, spawn a separate [ai]spell with that language setting, and dynamically feed modified, complete words into it. I know that ispell supports this mode well (gaim uses it, for one). Then, we'd have nice underlining for misspelled words -- most people will appreciate that.
Now, in order to check the document linearly, just go through its structure, and feed words into [ai]spell appropriately. That would also ensure that their TeX parsing doesn't mess up.

For purely static spell checking (I don't know why this model would be preferable, except to limit resource consumption), you might implement
a nice language dropdown in the spell check dialog, and depending on that dropdown, properly invoke [ai]spell, and feed into it only those words that are marked with the particular language (doing some simple black magic to associate them with the proper words in the text, like one-per-line with program-generated IDs escaped in a TeX fashion to make the spell-checker ignore them). Then, I would be able to check each of the languages' spelling separately, without getting conflicts, and without much pain. Even this, rather less powerful, option would make me happy.

I hope some discussion of the matter will ensue (or, even better, someone will tell me that it's already been done. Although I saw previous posts complaining of similar problems, I didn't see any with a solution).

I would gladly undertake some parts of this project, except that I'm swamped with work and completely unfamiliar with the LyX codebase. At best, I might be able to do this in 6 months, and even then, I wouldn't count on it.

Thanks for your attention,

Alexey Spiridonov

Reply via email to