context static method

Implementation

static String? context(
    TranslationMetadata meta, String path, Map<String, Object> param) {
  final node = meta.overrides[path];
  if (node == null) {
    return null;
  }
  if (node is! ContextNode) {
    print('Overridden $path is not a ContextNode but a ${node.runtimeType}.');
    return null;
  }
  final context = param[node.paramName];
  if (context == null || context is! Enum) {
    return null;
  }

  return (node.entries[context.name] as StringTextNode?)
      ?.content
      .applyParamsAndLinks(meta, param);
}