Multi lingual spell checking in mutt

GrouchyGaijin

I started using mutt a few days ago and found that I missed the ability of spell checking in both Swedish and English.
There are several ways to solve this problem, so you might know one that is better / easier than the solution I use.

1. You could just set an editor like abiword to be the mail editor in mutt.  In the .muttrc file add set editor="abiword"
I didn't want to do this, because after all, mutt runs in the terminal and using abiword (or whatever gui text editor) seems to violate the spirit of the thing.  ;)

2. You could use vim as the editor.  I had already managed to get vim to spell check Swedish and English, so that would be the obvious choice, right?  (Shhhh I don't like vim at all - I keep forgetting the key combinations to do things, not to mention to hit the escape key before I try to move to a misspelled word.)

3. I wanted to use nano.  Why, because it is easy and runs in the terminal.

The problem is that nano comes with a terrible spell check that only tells you which words it doesn't know.  If I knew how to spell them, would they be wrong?  Aspell on the other hand, offers useful suggestions.  I wanted to use Aspell.

The problem is that Aspell didn't like loading the en_US and sv_SE dictionaries together.  I tried making a custom dictionary and that worked OK, except not in mutt.  In mutt, I'd get a spell check abnormal failure.

Then I found this bash script that let's me choose which dictionary I want to load after I invoke the spell check command.

#!/bin/bash
read -p "Aspell: Select language: (US) SV" -s -n 1
case $REPLY in 
2|[Sv]) opts=( -l sv_SE.UTF-8 ) ;;
*) opts=( -l en_US.UTF-8 ) ;;
esac
exec aspell ${opts[@]} -e -c $1


Next I edited the nanorc file which on my system is at
/etc/nanorc
I changed the set speller setting to point to the script
set speller "/path/to/the/script/alpine_aspell"

Now when I hit the spell check command in nano (which my mutt uses) I get a choice: Press 1 for English or 2 for Swedish - and I'm good to go.

This worked for me.  I hope you find it useful.
Thank you,

GG

Sector11

Hey, nice stuff GG.  I'll have to try that with English - Spanish

Thanks for this.
Stay Home

GrouchyGaijin

Quote from: Sector11 on February 05, 2013, 10:11:36 PM
Hey, nice stuff GG.  I'll have to try that with English - Spanish

Thanks for this.

If you'd like to continue this email in English, press 1... :D
Thank you,

GG

Sector11

Stay Home

dizzie

mutt, how to use email like a boss!
Well done GG  8)
Reclaim your culture, it's within your reach!

My Blog | Facebook | Twitter | G+ | VSIDO |