SubMessage class

An abstract class to represent sub-sections of a message, primarily plurals and genders.

Inheritance
Implementers

Constructors

SubMessage()
SubMessage.from(String mainArgument, List clauses, dynamic parent)
Creates the sub-message, given a list of clauses in the sort of form that we're likely to get them from parsing a translation file format, as a list of key, value where value may in turn be a list.

Properties

arguments → dynamic
We find the arguments from the top-level MainMessage and use those to do variable substitutions. MainMessage overrides this to return the actual arguments.
read-only, inherited
attributeNames List<String>
read-only, inherited
codeAttributeNames List<String>
Return the list of attribute names to use when generating code. This may be different from attributeNames if there are multiple aliases that map to the same clause.
read-only
dartMessageName String
Return the message name we would use for this when doing Dart code generation, e.g. "Intl.plural".
read-only, inherited
examples → dynamic
We find the examples from the top-level MainMessage and use those when writing out variables. MainMessage overrides this to return the actual examples.
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
icuMessageName String
Return the name of the message type, as it will be generated into an ICU-type format. e.g. choice, select
read-only, inherited
mainArgument String
The name of the main argument, which is expected to have the value which is one of attributeNames and is used to decide which clause to use.
read / write
name String
The name of the top-level MainMessage.
read-only, inherited
parent Message
All Messages except a MainMessage are contained inside some parent, terminating at an Intl.message call which supplies the arguments we use for variable substitutions.
read / write, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

argumentsOfInterestFor(MethodInvocation node) Map
Return the arguments that affect this SubMessage as a map of argument names and values.
checkArgs(NamedExpression args, List<String> parameterNames) bool
Verify that the args argument matches the method parameters and isn't, e.g. passing string names instead of the argument values.
inherited
checkValidity(MethodInvocation node, List arguments, String outerName, FormalParameterList outerArgs, {bool nameAndArgsGenerated = false, bool examplesRequired = false}) String
Verify that this looks like a correct Intl.message/plural/gender/... invocation. [...]
inherited
escapeAndValidateString(String value) String
Escape the string for use in generated Dart code.
inherited
expanded([Function transform = _nullTransform]) String
Expand this string out into a printed form. The function f will be applied to any sub-messages, allowing this to be used to generate a form suitable for a wide variety of translation file formats.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toCode() String
Return a string representation of this message for use in generated Dart code.
override
toJson() Object
We represent this in JSON as a list with dartMessageName, the index in the arguments list at which we will find the main argument (e.g. howMany for a plural), and then the values of all the possible arguments, in the order that they appear in codeAttributeNames. Any missing arguments are saved as an explicit null.
override
toString() String
A string representation of this object. [...]
override
validate() → void
Verify that a constructed message is valid. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](String x) → dynamic
When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.
inherited
operator []=(String x, dynamic y) → void
When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.
inherited