generate_localized library

This provides utilities for generating localized versions of messages. It does not stand alone, but expects to be given TranslatedMessage objects and generate code for a particular locale based on them.

An example of usage can be found in test/message_extract/generate_from_json.dart

Classes

CodeMapMessageGeneration
Message generator that stores translations in a constant map.
DataMapMessageGeneration
Message generator that parses translations from a Map<String, dynamic>.
JsonMessageGeneration
MessageGeneration
TranslatedMessage
This represents a message and its translation. We assume that the translation has some identifier that allows us to figure out the original message it corresponds to, and that it may want to transform the translated text in some way, e.g. to turn whatever format the translation uses for variables into a Dart string interpolation. Specific translation mechanisms are expected to subclass this.

Functions

libraryName(String x) String
We can't use a hyphen in a Dart library name, so convert the locale separator to an underscore.