Inspectopedia Help

Message format validation in properties files

Reports the following MessageFormat problems in property values:

Unknown format types

MessageFormat supports only these format types:

  • number

  • date

  • time

  • choice

Other format types will be reported.

Unpaired quotes

property.key=Shouldn't happen: {0}

A single quote is interpreted as an escape until the end of the property, and will not be present in the result string. In most cases this is not what is intended. If a single quote should be present in the result string, it has to be duplicated in the property.

Unmatched braces

Every placeholder must have a closing brace.

Too many quotes

In some cases (e.g. it's), it is expected that only one quote ends up in the result string. Cases where two or more quotes are placed together in the result string are reported.

Incorrect lower bounds for nested ChoiceFormat

Lower bounds are expected to be numbers and to be sorted in ascending order.

Wrong number of quotes around parameters

In java.text.MessageFormat patterns single quotes are used for escaping. To keep quotes visible, they must be duplicated. For example when passing 1:

  • '{0}'{0}

  • ''{0}'''1'

When using choice format, nested formats are evaluated as format strings themselves, and quotes will need to be duplicated twice. For example when passing 1:

  • {0, choice, 0#no|#1''{0}'' files}{0} files

  • {0, choice, 0#no|#1''''{0}'''' files}'1' files


Property values are verified only if they contain the literal text {0}, {0,, {1} or {1,. This is to make sure that these property values are actually used as MessageFormat patterns.

New in 2023.2

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Plugin DevKit, 233.SNAPSHOT

Last modified: 13 July 2023