Format (or “BFormat”) is used to format objects into strings using a standardized formatting pattern language. The format
string is normal text with embedded scripts denoted by the % percent character (use %% to insert a real %). A script is one
or more calls chained together using the . dot operator. Calls are mapped to methods using reflections. Given call foo, the
order of reflection mapping are:
- special call
- getFoo(Context)
- getFoo
- foo(Context)
- foo
- get("foo")
The following special functions are available to use in a script:
- time calls Clock.time to get current time as an AbsTime
- lexicon(module:key) gets the specified lexicon text
Examples of formats:
- hello world
- my name is %displayName%
- my parent's name is %parent.displayName%
- %value% {%status.flagsToString%} @ %status.priority%
- %time.toDateString%
- %lexicon(bajaui:dialog.error)%