vscode-spell-checker icon indicating copy to clipboard operation
vscode-spell-checker copied to clipboard

Setting en-GB doesn't exclude US English spellings

Open TimothyJones opened this issue 2 years ago • 4 comments

Thanks for this excellent tool!

Using plugin v2.20.0 (VSCode 1.76.1, MacOS 13.2.1 on an Apple M1) and the following configuration:

"cSpell.language": "en-GB"

Expected behaviour

In a markdown file, realise and colourare accepted but realize and color are not

Actual behaviour

In a markdown file, all of realise, colour, realize and color are accepted.

If I set the language to:

"cSpell.language": "en_US"

Then the British English spellings are correctly rejected.

Is there some setting I am missing, or is this a bug?

TimothyJones avatar Mar 16 '23 04:03 TimothyJones

@TimothyJones,

A couple of things are going on.

  1. The Oxford English dictionary includes a lot of ize words.
  2. color might be included from other dictionaries being used.

To see where a word comes from, the cspell command line tool can help. cspell trace --help will show all the options.

Trace color

cspell trace --locale=en-gb --language-id=markdown color

image

In the case of color, markdown is coming from the html dictionary. This dictionary is included by default since markdown allows HTML.

If you would like, it is possible to disable the html dictionary in markdown files.

The simplest is to add the following to the bottom of the file:

<!--- cspell:dictionaries !html --->

Jason3S avatar Mar 16 '23 06:03 Jason3S

Thanks for the incredibly fast response and debugging information!

That does indeed fix it for my markdown files (although it means that my embedded mermaid diagrams are now complaining about color, of course 😂 ).

I reckon this debugging information would be worth including in the FAQ. If you agree, I'd be happy to make a PR.

TimothyJones avatar Mar 16 '23 07:03 TimothyJones

For those playing along at home - omitting the html dictionary didn't fix realize, which seems to be coming from en-gb (I think?):

Screenshot 2023-03-16 at 6 18 48 pm

Turns out it's correct - both are acceptable in British English. TIL

TimothyJones avatar Mar 16 '23 07:03 TimothyJones

I reckon this debugging information would be worth including in the FAQ. If you agree, I'd be happy to make a PR.

Documentation is one of the weak points of this extension, so PRs are most welcome!

Jason3S avatar Mar 16 '23 08:03 Jason3S