RedPen proved to be an extremely flexible and universal tool. We managed to add basic Russian language support without any major changes done to the code. In fact, the only thing that we had to implement was Russian language auto-detection. The rest worked out the box with simple modification made to the default symbols configuration: in Russian language «quote» is used instead of “quote” and № instead of #. Most likely, it will work equally fine for Ukrainian and Belorussian as well, and maybe some other languages using the Cyrillic script. This is how it looks like in RedPen Intellij Plugin:
Actually adding custom languages to RedPen can be done in Intellij IDEA without making any modifications to RedPen itself. Use Settings -> Editor -> RedPen-> Import.
For example, to add Russian language with correct double quotation marks, number sign and a couple of validators all you need to do is import a file with the following contents:
<redpen-conf lang="ru"> <validators> <validator name="InvalidSymbol"/> <validator name="NumberFormat"> <property name="decimal_delimiter_is_comma" value="false"/> <property name="ignore_years" value="true"/> </validator> </validators> <symbols> <symbol name="NUMBER_SIGN" value="№" invalid-chars="##" before-space="true"/> <symbol name="LEFT_DOUBLE_QUOTATION_MARK" value="«" invalid-chars=""" before-space="true"/> <symbol name="RIGHT_DOUBLE_QUOTATION_MARK" value="»" invalid-chars=""" after-space="true"/> </symbols> </redpen-conf>
Only symbols that are different from English configuration should be listed. As for validators, you need to list all that you would like to use.
Most European/Western languages should also work fine with RedPen either using the default English configuration or a slight modification of it.
If you decide to add your own custom language, then it is a good idea to export English language configuration via Settings -> Editor -> RedPen-> Export and to change the language name in lang attribute of redpen-conf tag of the resulting file. It will serve as a good template to start with.
Then, optionally, you can add spelling and/or other dictionaries by specifying file names in either dict or list validator properties. Dictionary files are just text files with words listed one per line.