65

I want Firefox to assume that text may be in a mixture of languages and words should be looked up in multiple dictionaries. (For example, everything in en-GB, en-US, ru, be and be-classic should be consider as good, everything else should be underlined and corrections from all dictionaries should be offered). Is there an add-on for "multi-language spell-check"?

Alternatively, can I merge all dictionaries into one big combined dictionary?

Vi.
  • 17,755

9 Answers9

28

I use French and English in almost all of my emails and this is a nightmare.

There is a (quite simple) solution, but you need to hack one of your dictionaries: copy-paste the content of e.g. your English dictionary into your French one; it works! As simple as that!

This is how I solved this issue on Mac OS X:

  1. Go to /Users/HERE_YOUR_USER/Library/Application Support/Firefox/Profiles (use Cmd-Shift-G if your Library folder is hidden), and select your profile folder (mine was default.uo0) and the extensions folder.

  2. You will see folders for each of your dictionaries (en-US@dictionaries.addons.mozilla.org and fr-classique-reforme1990@dictionaries.addons.mozilla.org in my case). In each main folder, a dictionaries folder.

  3. Copy the content of the .aff and .dic of one of your dictionaries into the .aff and .dic file of the other. Don't copy the first line in the .dic file; it's the word count!

Warning: in the .dic file, update the word count on the first line. It must be the number of lines of the file minus 1 (the first which is the word count).

  1. Restart Firefox! And now, vous pouvez taper en français et in English in the same text area!
10

Seems like Firefox 100 can support spellchecking multiple languages natively.

https://www.mozilla.org/en-US/firefox/100.0/releasenotes/

Firefox spell checking now checks spelling in multiple languages. To enable additional languages, select them in the text field’s context menu.

Vi.
  • 17,755
8

Unfortunately, I don't believe there is an easy solution to this. I use two different languages on a daily basis and the best (not ideal) solution is a combination of multiple dictionaries and an add on such as:

Dictionary Switcher or Quick Locale Switcher

Both of which present their own problems.

Another, less than ideal solution, is:

ImTranslator

Whilst it is a translator, it also supports multilingual spell checking.

Flimzy
  • 4,465
Pulse
  • 4,589
  • 2
  • 21
  • 20
8

Thanks François; this was inspiring. The corresponding solution in Ubuntu/Linux does the same for the hunspell. I wanted to combine my English dictionary with Hebrew, and I did this:

cd /usr/share/hunspell
sudo cp he.dic he.dic.bak
sudo cp he.aff he.aff.bak
sudo sh -c 'cat en_US.dic >> he.dic'
sudo sh -c 'cat en_US.aff >> he.aff'

(The sh -c is required since the append, >>, operation needs sudo privileges also). And of course fix the number of lines on the top of the .dic file like you said (count the lines using wc -l he.dic.

fidlr
  • 81
5

Somewhat embarrassingly, I mixed up Thunderbird and Firefox. The method should work equally for both though, except that the firefox profiles are stored in ~/.mozilla/firefox, not ~/.thunderbird.


As of writing, most answers don't work straight forward or at all anymore. The closest is the recommendation to add content to persdict.dat, but the answer of Dolanor doesn't work straight forward with modern versions of spell checkers, because the dictionary files typically don't contain all variants of the words -- but rather rules how to form them from a dictionary of base forms.

What I did instead was to use the command

unmunch /usr/share/hunspell/en_US.{dic,aff}

to generate a list of all variants and append that to $HOME/.thunderbird/<PROFILEFOLDER>/persdict.dat. This should work for any language; In my case I am using a German dictionary in thunderbird, with en_US added to the persdict.dat file.

Limitations

While this works in principle, there will remain cases that are not handled well due to rules that go beyond the forming of the words.

With a German main dictionary and an English generated persdict.dat in particular, the spell checker will complain about constructs like hyphenated English words.

As pointed out by jbrock's comment, this setting also doesn't account for the possibility of English words being capitalized (e.g. title case style). They provided a solution in the comment.

kdb
  • 2,451
2

Thanks fidlr, this was inspiring. ;)

I wanted to do the same without using root rights for that. So I based my work on you and came to use the personal dictionary: Warning, my personal dictionary was empty, it will surely destroy yours if you have some data in here.

cd ~/.mozilla/firefox/*.default/
nbLines=$(wc -l < /usr/share/hunspell/fr_FR.dic)
cut -d/ -f1 /usr/share/hunspell/fr_FR.dic | tail -$(( --nbLines )) >> ./persdict.dat

I remove the first line of the dictionary, because it's the number of dictionary entries in the .dic file.

Dolanor
  • 419
0

I found a hack that sort of works using the Firefox user dictionary.

You can manually add individual words to your personal user dictionary which will then not be marked as typos. You can also edit the file for it ('persdict.dat' within your Firefox profile folder) and add LOTS of words to it. I downloaded a dictionary list for my second language with 400k words and just paste it in the .dat file, which is essentially a text file you can open with any editor.

Now I can type in two languages without annoying spell check underlines.

0

Modifying dictionary no loner works (dictionaries are elsewhere than specified in answers and are signed, so no modification is possible). It is possible to add entries to persdict.dat - words that you add manually go there. To generate all possible words in polish on Linux close Firefox and use following command:

unmunch /usr/share/hunspell/pl_PL.{dic,aff} 2>/dev/null \
 | iconv -f iso-8859-2 -t utf-8 \
 > /home/mateuszzz/.mozilla/firefox/z2d3veoq.default-release/persdict.dat

I determined input encoding with program enca.

This still isn't full solution, as Capitalized variants of words are not generated and still treated as errors ("dobrze" is recognized as correct, "Dobrze" at beginning of sentence is not).

Warning: it is important to close Firefox before running this command.

MateuszL
  • 101
0

I found one very small and underrated addon to solve this porblem: Automatic Spelling Language

It solves it at 90%, as it switches to language that has most symbols, not counting the white-spaces. For the most of the use cases this hould suffice. IDK why Mozilla can't just inject it to be the native part of browser, instead of making "multilingual" spellchecking that does not work at all.

Don't forget to delete your content-prefs.sqlite file!