toARB function

Map toARB(
  1. MainMessage message, {
  2. bool supressMetadata = false,
  3. bool includeSourceText = false,
})

Convert the MainMessage to a trivial JSON format.

Implementation

Map toARB(
  MainMessage message, {
  bool supressMetadata = false,
  bool includeSourceText = false,
}) {
  if (message.messagePieces.isEmpty) return {};
  var out = {};
  out[message.name] = icuForm(message);

  if (!supressMetadata) {
    out["@${message.name}"] = arbMetadata(message);

    if (includeSourceText) {
      out["@${message.name}"]["source_text"] = out[message.name];
    }
  }

  return out;
}