Now that Intellij IDEA (12.1.3 in my case) supports auto completion & syntax highlighting for cucumber features not only in english but also in any other language that is available for gherkin it would be nice to have native spell checking as well.
To use your native language with cucumber you just have to place a
language comment at the first line of your feature file. For example see this super useful feature description:
# language: de Funktionalität: deutsche Feature-Beschreibungen Um cucumber in unserer Muttersprache zu benutzten möchte ich als Szenario-Schreiber die deutschen Schlüsselwörter benutzen Szenario: deutsche Schlüsselwörter & Steps Angenommen ich schreibe eine Feature-Beschreibung Wenn ich die deutschen Gherkin-Schlüsselwörter benutze Dann werden die deutschen Steps aufgerufen
To get spell checking for an additional language in IntelliJ we need to add a dictionary for that language. This is done in a few simple steps:
- first, we need a dictionary for our language. This is a plain text file with a lot of words, each on a single line. I found a german dictionary on sourceforge.
- second, we need to make sure it is encoded in utf–8. The
german.dicfile was encoded in latin–1. If it is not encode in utf–8 use your text editor of choice (e.g. Notepadd++ or TextWrangler or …) and convert it to utf–8 (no BOM).
- third, create a folder (e.g. dictionaries) where you want to save the dic file
- fourth, tell IntelliJ about the dictionary folder following the documentation, which is in short:
- open the Settings dialog
- type ‘spell’ into the search box and select Spelling
- switch to the Dictionaries tab
- and add the folder to the Custom Dictionaries Folder list
You should see now the dictionary under Dictionaries as a user dictionary and the checkbox enabled.
That’s it, no more typos in the features :-)