map static method

Implementation

static Map<String, String>? map(TranslationMetadata meta, String path) {
  final node = meta.overrides[path];
  if (node == null) {
    return null;
  }
  if (node is! ObjectNode) {
    print('Overridden $path is not an ObjectNode but a ${node.runtimeType}.');
    return null;
  }
  if (!node.isMap || node.genericType != 'String') {
    print('Overridden $path can only be a map containing plain Strings.');
    return null;
  }

  return {
    for (final entry in node.entries.entries)
      entry.key: (entry.value as StringTextNode).content.applyLinks(meta, {}),
  };
}