function formatMessage(message, values, locale) {
  message = escapeIcuMessage(message);

  // Parsing and formatting can be slow. Don't attempt if the string can't
  // contain ICU placeholders, in which case formatting is already complete.

  // When using accented english, force the use of a different locale for number formatting.
  const localeForMessageFormat = (locale === 'en-XA' || locale === 'en-XL') ? 'de-DE' : locale;

  // This package is not correctly bundled.
  /** @type {typeof IntlMessageFormat} */
  // @ts-expect-error bundler woes
  const IntlMessageFormatCtor = IntlMessageFormat.IntlMessageFormat || IntlMessageFormat;
  const formatter = new IntlMessageFormatCtor(message, localeForMessageFormat, formats, {
    ignoreTag: true,
  });

  // Preformat values for the message format like KB and milliseconds.
  const valuesForMessageFormat = _preformatValues(formatter, values, message);

  const formattedResult = formatter.format(valuesForMessageFormat);
  // We only format to strings.
  if (typeof formattedResult !== 'string') {
    throw new Error('unexpected formatted result');
  }
  return formattedResult;
}
Format string `message` by localizing `values` and inserting them. `message`
is assumed to already be in the given locale.
If you need to localize a messagem `getFormatted` is probably what you want.
@param {string} message
@param {Record<string, string | number>|undefined} values
@param {LH.Locale} locale
@return {string}