MessageExtraction class

A particular message extraction run.

This encapsulates all the state required for message extraction so that it can be run inside a persistent process.

Constructors

MessageExtraction({OnMessage onMessage = print, bool suppressWarnings = false, bool allowEmbeddedPluralsAndGenders = true, bool examplesRequired = false, bool descriptionRequired = false, bool warningsAreErrors = false, Set<String> ignoredErrorCodes = const <String>{}})

Properties

allowEmbeddedPluralsAndGenders bool
Are plural and gender expressions required to be at the top level of an expression, or are they allowed to be embedded in string literals.
getter/setter pair
descriptionRequired bool
getter/setter pair
examplesRequired bool
Are examples required on all messages.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasWarnings bool
Were there any warnings or errors in extracting messages.
no setter
ignoredErrorCodes Set<String>
Error codes that should be ignored.
getter/setter pair
mergeMessages ↔ (MainMessage Function(MainMessage, MainMessage)?)
How messages with the same name are resolved.
getter/setter pair
onMessage OnMessage
What to do when a message is encountered, defaults to print.
getter/setter pair
origin String?
An arbitrary string describing where the source code came from. Most obviously, this could be a file path. We use this when reporting invalid messages.
getter/setter pair
root ↔ CompilationUnit
The root of the compilation unit, and the first node we visit. We hold on to this for error reporting, as it can give us line numbers of other nodes.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
suppressWarnings bool
If this is true, print warnings for skipped messages. Otherwise, warnings are suppressed.
getter/setter pair
warnings List<String>
This accumulates a list of all warnings/errors we have found. These are saved as strings right now, so all that can really be done is print and count them.
final
warningsAreErrors bool
If this is true, then treat all warnings as errors.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseContent(String fileContent, String filepath, bool transformer) Map<String, MainMessage>
Parse the source of the Dart program from a file with content fileContent and path path and return a Map from message names to IntlMessage instances.
parseFile(File file, [bool transformer = false]) Map<String, MainMessage>
Parse the source of the Dart program file file and return a Map from message names to IntlMessage instances.
reportErrorLocation(AstNode node) String
toString() String
A string representation of this object.
inherited

Operators

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