Multilingual spell check

[2010-08-24] computers
(Ad, please don’t block)

In Apple Mail you can mix different languages and the spell check still works as expected (see above). I wonder how they do this. Probably by assigning that language to a sentence that produces the least errors. I also remember from a cryptography lecture that one can compute a numeric index for a text (from letter frequency) that indicates the language. Incidentally, this index is relatively robust with regard to encryption.