JsonAdapter class
Backend JSON adapter — emits the two stable on-disk contracts a backend localizer library reads:
icu-json(dialect/spec/icu-json.md) — flatkey → valueJSON with ICU MessageFormat expressions preserved verbatim. For backends with an ICU runtime (MessageFormat.NET,intl-messageformat, …).flat-json(dialect/spec/flat-json.md) — same shape, but every plural / select / selectordinal collapses to itsotherbranch and typed placeholders drop their format suffix. For backends with no ICU runtime that only do plain{placeholder}interpolation.
Both formats share the file shape: a UTF-8 JSON object, flat string
keys (the ARB key verbatim — never nested), 2-space indent, LF endings,
trailing newline, keys sorted lexicographically. @@-metadata and
@key blocks are never emitted — the locale is in the filename and
metadata is an ARB-side concern.
Namespace filtering and translation-metadata stripping are handled upstream by ArbAdapter.prepare; this adapter only encodes the already-filtered ArbFile. That keeps the namespace contract identical across every output format.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
encode(
ArbFile arb, {required bool stripPlurals}) → JsonEncodeResult -
Encode a (namespace-filtered)
arbto backend JSON. -
filenameFor(
String locale) → String -
Filename for a backend JSON locale file:
<locale>.json(e.g.en.json,pt-BR.json). Bothicu-jsonandflat-jsonuse it. -
handles(
String format) → bool - True for the two formats this adapter handles.