Skip to content

Coding styles

OmegaT project uses following coding style rules and coding policy.

  • Each java file has a GPL3 copyright header. OmegaT has a unit test to check header.
  • Source code has a maximum 120 characters in each line.
  • The Maximum line length of comments in sources is 80 characters
  • Indentation is 4 spaces. Don't use TAB character.
  • We don't use asterisk import. You should expand all individual imports.
  • You are recommended to put javadoc comments for all your public methods.
  • We don't set method arguments "final", but you are recommended to treat it as final.
  • Bundle properties should be ASCII, 7bit clean. All translations should be escaped.
  • It will change to be UTF-8 after OmegaT version 6.1 beta release.
  • Stable APIs should be under "org.omegat.core" package.
  • GUI parts can be;
  • written by hand, or
  • Use NetBeans GUI builder
  • We don't accept other GUI builder materials;
  • such as JetBrains IntelliJ GUI builder, JForm Designer, Eclipse Window builder.
  • If you want, you are recommended to implement it as a plugin.
  • We move XML parser to be StAX based instead of JAXB because of performance.
  • We use Jackson XML serialization library.

language and characters

  • OmegaT project uses UTF-8 characters for comments in java source file in general.
  • You should use English for comment language.
  • You should use ASCII characters and 7bit clean for variable names, method names et. al.
  • You are allowed to use String literals in UTF-8 encoding.
  • You should use Bundle for localization strings.
  • You can not use Right-to-Left direction characters in comments.
  • You can not use invisible characters such as non-breakable-space.
  • When you need invisible characters in literals, please use unicode escape.

Lint check

OmegaT project configures a build script with several linting tools. You can check your code with;

./gradlew check


You can check your code with Checkstyle linting tool. A project configuration is stored in config/checkstyle/checkstyle.xml We treat checkstyle lint error as warning, but you are recommended to improve your code before sending your patch to the core team.

Spotless code formatter

Spotless is a general purpose code formatting tool that makes code spotless. It will help you to format your changed code just a command

./gradlew spotlessChangedApply

OmegaT uses Spotless plugin for gradle and configured with eclipse formatting configuration This XML file is project-standard indent configuration for Eclipse IDE, but also uses as spotless formatting rule.

There is other sample config file for IDE such as JetBrains IntelliJ Project configuration.