entityFromContext(ctx, errors, id, args) {
    const entity = ctx.messages.get(id);

    if (entity === undefined) {
      errors.push(new L10nError(`Unknown entity: ${id}`));
      return { value: id, attrs: null };
    }

    const formatted = {
      value: ctx.format(entity, args, errors),
      attrs: null,
    };

    if (entity.attrs) {
      formatted.attrs = {};
      for (const name in entity.attrs) {
        const attr = ctx.format(entity.attrs[name], args, errors);
        if (attr !== null) {
          formatted.attrs[name] = attr;
        }
      }
    }

    return formatted;
  }
Format all public values of a message into a { value, attrs } object.

This function is passed as a method to `keysFromContext` and resolve
a single L10n Entity using provided `MessageContext`.

The function will return an object with a value and attributes of the
entity.

If the function fails to retrieve the entity, the value is set to the ID of
an entity, and attrs to `null`. If formatting fails, it will return
a partially resolved value and attributes.

In both cases, an error is being added to the errors array.

Subclasses of `Localization` can override this method to provide
environment-specific formatting behavior.

@param   {MessageContext} ctx
@param   {Array<Error>}   errors
@param   {String}         id
@param   {Object}         args
@returns {Object}
@private