MessageAttribValueFormatter

Inserts the values of the given attribute of the parameter

Format:

{ PARAMETER_NUMBER, attr-NAME, {DEFAULT}}
- NAME
    Name of the attribute
- DEFAULT
    Optional default value, if the attribute is null

Example:

{0} has gender {0, attr-gender, {unknown}}.

Usage:

FORGOTTEN_BAG( PETER )
-> Peter has gender male.
FORGOTTEN_BAG( MARY )
-> Mary has gender female.

For files storing the attribute, the name of the attribute is appended as an extension after the locale tag via “-x-attr-NAME“. E.g. for the attribute “gender”:

names_de_DE_saxiona-x-attr-gender
names_de_DE-x-attr-gender
names_de-x-attr-gender
names_en-x-attr-gender
names_fr_FR-x-attr-gender

e.g.

subjects_en.properties

peter=male
mary=female

Properties

Link copied to clipboard
open override val typeId: String

ID of the type of the formatter

Link copied to clipboard
open override val typeIdIsPrefix: Boolean

True if typeId is just a prefix for the type.

Functions

Link copied to clipboard
open override fun format(result: StringBuilder, value: Any?, typeId: CharSequence, style: StylePart?, parameters: MessageParameters, locale: Locale, context: MessageFormatContext)

Formats the given value and writes is to result.

Link copied to clipboard
fun formatAttribute(result: StringBuilder, attrName: CharSequence?, value: Any?, style: StylePart?, parameters: MessageParameters, locale: Locale, context: MessageFormatContext)