Formatting values and text
Load this card when a task declares a typed or formatted value: a date, time
or duration type, Money, PhysicalUnit, Bitflags, a Format display
pattern, the package StringResources catalog, a FormattedText value, or a
translation of localized strings. Its rules are generated from the
presentation contract, which owns them; the
messages card carries the LMF1 template and argument rules
of the Libertas Message Format, the
translation card the locale-document workflow, and the
annotation inventory gives each attribute's Rust and
TypeScript spelling. Presentation metadata never
changes the underlying typed wire value.
Order of work
- Give each number its meaning: date and time types (
datetime.*), exact amounts (money.*), units (unit.*), flag sets (bitflags.*). - Add a display pattern only where the locale default is wrong (
fmt.*); the pattern compiles into the template'sformathint, which the Display Template card may vary per device. - Declare the catalog and encode dynamic wording as
FormattedText(text.*), with its staticReadOnlyplacement and request values. - Translate strings only, preserving every LMF1 structure (
translate.*). - Compile with the Studio MCP
compile_schematool and fix every reported rule.
Rules to apply
Studio does not check these rules. Each is quoted from its owner.
Date and time
Owner: presentation.md#date-and-time
-
datetime.types:Type Raw meaning Presentation LibertasDateTimeEpoch seconds Viewer-local date/time; optional timezone in Format. -
datetime.date-only-calendar: Never convertDateOnlythrough an epoch or timezone. Defaults, fixed values, requests, and runtime data must all be valid calendar dates.
Money
Owner: presentation.md#money
money.no-conversion: Currency identity does not introduce conversion: applications own exchange rates and must keep unrelated currencies separate. Money follows the exclusions of numeric semantic attributes.
Physical units
Owner: presentation.md#physical-units
unit.translate-text-not-identifiers(judgment): Translate field names, descriptions, chart titles, and other authored text through the App's locale documents, not by changing unit identifiers or appending translated unit strings to numeric values.unit.no-conversion: The identifier states the provided unit and never performs conversion.percentraw50means fifty percent; it does not rescale0.5.Formatmay coexist and formats only the numeric portion. PhysicalUnit follows the exclusions of numeric semantic attributes.
Bitflags
Owner: presentation.md#bitflags
bitflags.document-members(judgment): Author the meaning and consequences of each flag in its member comments.
AI tool-call output
Owner: presentation.md#ai-tool-call-output
text.document-purpose-not-templates(judgment): DeclareFormattedTextand document the message's domain purpose; do not repeat templates or rendering instructions in field comments for the AI.
Static read-only placement and request values
Owner: presentation.md#static-read-only-placement-and-request-values
text.request-values: Request and SubscriptionRequest fields may carry these display-only values. Their values come fromCopyFromorCopyTo, including a copy of an enclosing record or request root; suppliedEditRequestvalues; orDefault/Fixedinitialization. A leaf does not need its ownCopyFromwhen one of those paths supplies it. Apply the shared copy rules to copied values. The client never asks the user to edit a formatted tuple. An unanswered local field may remain undefined; a required undefined field blocks submission. Null is valid only where the destination permits it.
Persisting formatted record payloads
Owner: presentation.md#persisting-formatted-record-payloads
text.persist-discouraged(judgment):FunctionDataSchemarecord payloads may contain statically read-onlyFormattedText. Persistence is supported, but generally discouraged for these payload fields:FormattedTextsupplies runtime rendering, so prefer storing structured domain values and constructing the formatted value at presentation time. This is design guidance, not a schema rejection rule.
Declaring and encoding formatted values
Owner: presentation.md#declaring-and-encoding-formatted-values
text.enum-arguments-typed(judgment): ForROOM_STATUS, encode argument 0 as theLibertasDeviceobject and argument 1 as a unit-qualified temperature number. Do not pass a translated state as a literal or resource-text grammar fragment. A closed Enumeration instead uses{1,LibertasEnum,ActualEnumType}and an integer argument encoded with that Enumeration's semantic type.formatted.encoding.no-extra-base64: FormattedText always uses the public SDK's canonical Bytes encoding of a resource key plus ordered typed Libertas Message Arguments, including an empty argument list. Do not Base64-wrap it in App code. A String host would only encode the tuple and force the renderer to decode it again, providing no benefit; Bytes also keeps a sharp type distinction from literal String data and prevents authoring mistakes. A generic JSON byte codec may use Base64 as a transport spelling without changing the field's Bytes type. Runtime payloads never carry format templates.
Rules Studio enforces
Studio checks these rules and reports errors or warnings as their owners specify. The owner holds the full rule.
Display formats
Owner: presentation.md#display-formats
fmt.one-portable-pattern:Formatis one portable Unicode LDML pattern that never changes parsing, storage or chart geometry; it compiles into the templateformathintfmt.number-grammar: Portable number grammar:0 # . , ;subpatterns,%,‰,E, affixes, apostrophe quoting; no@,*, wider currency tokens or rounding incrementsfmt.currency-needs-money:¤and¤¤require explicitMoneymetadatafmt.date-time-fields: Date fieldsG y M d E, time fieldsH h m s S a,zonly for DateTime; DateOnly date fields only, TimeOnly time fields only, neverHwithh
Money
Owner: presentation.md#money
money.i64-minor-units:Moneygoes on a signedi64Number storing minor units; the currency code and scale are schema metadatamoney.code-and-scale: The currency code is three uppercase letters and the scale 0 through 6; choose the currency's minor-unit scalemoney.currency-pattern: A currency pattern controls presentation only, rounds half up for display, and cannot use percent, per-mille or scientific notationmoney.bounds-in-minor-units: MoneyDefault,Fixed,NumberMin,NumberMaxand a positiveNumberStepare integer minor units; bounds and rules operate on minor units
Bitflags
Owner: presentation.md#bitflags
bitflags.single-bits: Each nonzero Bitflags member is one unique bit, one zero label is allowed, and values combine only declared bits
Static read-only placement and request values
Owner: presentation.md#static-read-only-placement-and-request-values
text.static-readonly: Every FormattedText node is statically ReadOnly: on the field, its type, or an enclosing read-only Table (a ReadOnly List does not count)text.not-in-function-arguments: FormattedText is forbidden in function and configuration arguments, even when read-only