Spellchecking provided by IntelliJ Idea is very handy for those who are not confident in written English (such as me for example ).
But for non-English speaking developers it’s common to use (at least) two languages simultaneously – English for writing Javadoc, method and variable names and their native language (Czech, Polish …) for strings in UI layer. Setuping Ideas‘ spellchecker to validate string in multiple languages is more than handy. This article will guide you through setuping your native dictionary.
In the default installation you have only English and JetBrains dictionary enabled. So when you open your localization property bundle it can look like this:
But you’d probably want to validate either your own native sentences – as there could be mistakes too. In order to make Idea validate these strings you have to perform these 3 steps:
1. Find your language dictionary
There are several sources on the web. I found our Czech dictionary on WinEdt community site – there are plenty of other languages too:
So download your language dictionary in DIC format.
2. Convert the dictionary file into UTF-8 encoding
IntelliJ Idea, though its not mentioned in documentation, reads dictionary files in UTF-8 encoding. Usually your downloaded dictionary doesn’t conform to this encoding. Czech dictionary on WinEdt site was stored for example in „windows-1250″ codepage.
Because dictionary files are very large, you could have problems converting them to UTF-8 (for example Idea and Notepad++ both failed to convert 4MB txt file to the desired encoding). I was successful with my own transformation utility (available for download here – Google translated version of the article).
3. Configure IntelliJ Idea to use the dictionary
Finally open IntelliJ Idea settings dialog, locate Spelling settings and Add custom folder at Dictionaries tab. You should create individual folder for storing DIC files, because when targeting Idea to some high level folder, it starts to recursively search for all *.DIC files and in case of huge folders it could take several minutes till it finishes (yes, I did this wrong for first time ).
After enabling custom dictionary in the bottom section of the tab your native sentences should be validated as expected. Even auto-correction should offer similar words at the places where Idea underlines invalid words.
The same screen should now look like this: