formatWithFallback(bundles, ctx, keys, method, prev) {
    // If a context for the head bundle doesn't exist we've reached the last
    // bundle in the fallback chain.  This is the end condition which returns
    // the translations formatted during the previous (recursive) calls to
    // `formatWithFallback`.
    if (!ctx) {
      return prev.translations;
    }

    const current = keysFromContext(
      method, this.sanitizeArgs, ctx, keys, prev
    );

    // In Gecko `console` needs to imported explicitly.
    if (typeof console !== 'undefined') {
      // The `errors` property is an array of arrays, each containing all
      // errors encountered for the translation at the same position in `keys`.
      // If there were no errors for a given translation, `errors` will contain
      // an `undefined` instead of the array of errors.  Most translations are
      // simple string which don't produce errors.
      current.errors.forEach(
        errs => errs ? errs.forEach(
          e => console.warn(e) // eslint-disable-line no-console
        ) : null
      );
    }

    // `hasFatalErrors` is a flag set by `keysFromContext` to notify about
    // errors during the formatting.  We can't just check the `length` of the
    // `errors` property because it is fixed and equal to the length of `keys`.
    if (!current.hasFatalErrors) {
      return current.translations;
    }

    // At this point we need to fetch the next bundle in the fallback chain and
    // create a `MessageContext` instance for it.
    const tailBundles = bundles.slice(1);
    const { createHeadContext } = properties.get(this);

    return createHeadContext(tailBundles).then(
      next => this.formatWithFallback(
        tailBundles, next, keys, method, current
      )
    );
  }
Format translations and handle fallback if needed.

Format translations for `keys` from `MessageContext` instances
corresponding to the current bundles.  In case of errors, fetch the next
bundle in the fallback chain, create a context for it, and recursively
call `formatWithFallback` again.

@param   {Array<ResourceBundle>} bundles - Current bundles.
@param   {Array<Array>}          keys    - Translation keys to format.
@param   {Function}              method  - Formatting function.
@param   {Array<string>}         [prev]  - Previous translations.
@returns {Array<string> | Promise<Array<string>>}
@private