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?

3
  • 1
    What Operating System are you on ?
    – Studer
    Commented Feb 12, 2010 at 20:56
  • GNU/Linux Debian (mostly squeeze)
    – Vi.
    Commented Feb 12, 2010 at 20:58
  • I also wish Firefox could do this. Not strictly an "answer," but you could try using Chrome, which does support multiple-language spell checking out of the box: google.com/support/chrome/bin/answer.py?hl=en&answer=95604.
    – Arthaey
    Commented Jun 20, 2011 at 18:26

9 Answers 9

29

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 ([email protected] and [email protected] 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!
7
  • 1
    Just did a cp extensions/[email protected]/dictionaries/* extensions/[email protected]/dictionaries/ here. Didn't seem to work very well. How did you join the files exactly?
    – jpbochi
    Commented Feb 19, 2014 at 15:07
  • 1
    I had English and Ukrainian dictionaries (in this order). When I copied Ukrainian into English, it didn't work at all. But when I copied English into Ukrainian, it worked but I needed to remove SET ISO8859-1 before en-gb.aff, otherwise plurals and other forms would be marked. Commented May 7, 2015 at 9:13
  • 1
    Bizarre, these dictionary folders are not in my profile folder...
    – bart
    Commented Aug 21, 2015 at 20:44
  • 1
    @François Thanks! That's an elegant solution. Do you have to do this over and over again with every update of Firefox? Commented Nov 9, 2015 at 18:40
  • 1
    @IIya nope, the dictionary is still bilingual after several Firefox updates. But don't update your dictionary ;) Commented Nov 17, 2015 at 16:02
9

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.

4
  • It is not working reliably. Some combination of languages mess everything up. For example, when I use British ENG + Ukrainian British text never gets checked. But with US + Ukrainian it works... Also British + Russian works fine.... Its a freaking mess... Commented Jun 16, 2022 at 16:37
  • Actually no. I just checked. Ukrainian breaks both US and British. But not Russian… Russian does not break English............ This is extremely frustrating! Commented Jun 16, 2022 at 16:59
  • @ScienceDiscoverer Is it this bug? If so, you are invited to vote for it (or comment, if votes are not supported).
    – Vi.
    Commented Jun 18, 2022 at 22:09
  • It seems that you need to set multiple dictionaries for each site on its own. Is there a setting somewhere to set it up as default for all sites?
    – dreua
    Commented Jun 28, 2023 at 18:25
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.

2
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.

1
  • 4
    What is "hunspell"? Commented Mar 31, 2018 at 19:15
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.

1
  • 2
    I really appreciate this answer. I noticed after following the steps that the words which start with capital letters were being marked. I therefore ran this to have a version for each word that starts with a capital letter. while read -r l; do var="$var $l ${l^}"; done < persdict.dat; echo "$var" | tr ' ' '\n' | awk '!NF || !seen[$0]++' | sed '1d' > new-persdict.dat. This command takes a while. Here is my generated persdict.dat file for en_US. brockcochran.com/1/persdict.dat
    – jbrock
    Commented Oct 7, 2021 at 18:27
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.

2
  • 1
    This is the only answer, that still works directly in Thunderbird 78.x. However, more processing may be needed; The persdict.dat file is "dumb" and lines are interpreted directly as words. By contrast, hunspell dictionaries contains flags separated by /, which need to be stripped, and different grammatical forms have to be generated. In my case I added the English dictionary to persdict.dat, and had to add plural variants and title-case variants separately.
    – kdb
    Commented Jan 20, 2021 at 15:13
  • 2
    Also, for skipping the first lines it is easier to just use tail -n +2.
    – kdb
    Commented Jan 20, 2021 at 15:14
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.

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!

2
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jun 16, 2022 at 20:26
  • I'm not sure that bot hint inviting to make edits is relevant, but the deletion of content-prefs.sqlite should indeed be elaborated - why the file needs to be deleted?
    – Vi.
    Commented Jun 18, 2022 at 22:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .