l10n.arb library

Classes

InterpolationVisitor
Given an interpolation, find all of its chunks, validate that they are only simple variable substitutions or else Intl.plural/gender calls, and keep track of the pieces of text so that other parts of the program can deal with the simple string sections and the generated parts separately. Note that this is a SimpleAstVisitor, so it only traverses one level of children rather than automatically recursing. If we find a plural or gender, which requires recursion, we do it with a separate special-purpose visitor.
MessageExtraction
A particular message extraction run. [...]
MessageFindingVisitor
This visits the program source nodes looking for Intl.message uses that conform to its pattern and then creating the corresponding IntlMessage objects. We have to find both the enclosing function, and the Intl.message invocation.
PluralAndGenderVisitor
A visitor to extract information from Intl.plural/gender sends. Note that this is a SimpleAstVisitor, so it doesn't automatically recurse. So this needs to be called where we expect a plural or gender immediately below.

Functions

computeMessageName(String name, String text, String meaning) → String
If a message is a string literal without interpolation, compute a name based on that and the meaning, if present.
generateTranslationFile(Directory dir, File file, String locale, Map<String, MainMessage> allMessages, dynamic overwriteLocaleFile, bool suppressWarning) → void
Bases on intl_messages.arb a translatable file gets create if it doesn't exist [...]
scanDirsAndGenerateARBMessages(MessageExtraction intlExtractor(), L10NMessageExtraction l10Extractor(), HTMLExtraction htmlExtractor(), List<String> dirstoscan, List<String> dirsToExclude) → Future<Map<String, MainMessage>>
Iterates through dirs and generates a map of MainMessages
writeMessagesToOutputFile(Directory dir, File file, Map<String, MainMessage> allMessages) → void
Generates the base .arb-File [...]

Typedefs

OnMessage(String message) → void
A function that takes a message and does something useful with it.