TranslationCatalog class sealed

One catalog, as tool/flutterware.dart declares it.

Sealed, for the reason StackRun is: the variants do not carry the same thing. A file per locale is found with a glob, because there is one file for each of them; every locale under a key is one file, and files naming it would be a plural that is never plural. The gap widens with the next format rather than closing — an ARB carries its locale inside the file and hides metadata under @-prefixed keys, a CSV needs to be told its delimiter and which column holds the key. None of those are a mode of one shape; each is its own set of questions, and a class per format is where the answers go.

The alternative — one class with a layout: and the union of every format's parameters on it — reads fine at two and stops reading at three, because most of the fields on any one declaration would not apply to it.

Implementers

Constructors

TranslationCatalog({required String name, required String files, String template})
One file per locale, named for it, each a flat object of key to string: en.json holding {"save": "Save"}.
const
factory
TranslationCatalog.localesPerKey({required String name, required String file, String template})
Every locale under each key, in one file: strings.json holding {"save": {"en": "Save", "nl": "Opslaan"}}.
const
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
layout → String
The value of layoutKey this variant writes, and what TranslationCatalog.fromJson reads it back by.
no setter
name → String
What the seam calls it — indexTranslations('app') and this must agree.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
template → String
The locale the source text is written in.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, Object?>
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromJson(Map<String, Object?> json) → TranslationCatalog?
Reads back what toJson wrote, or null for a layout this build does not know — a project pinning a newer flutterware than the studio opening it, which is a thing to report rather than to guess at. Guessing would read a CSV as JSON and call the catalog empty.

Constants

layoutKey → const String
Where a serialised catalog says which variant it is.