import { VegaSlimmer } from 'vega-slimmer/core';
import { VegaInternalTranslation } from '../translation/internal-translation-controller';
/** The `FormFieldMessageTranslatorSlimmer` class is to get translated message */
export class FormFieldMessageTranslatorSlimmer extends VegaSlimmer {
  /**
   * Translates a given message based on its type.
   *
   * @param {EvaluateResult['message'] | EvaluateResultTranslation['message']} message - The message to be translated, which can be a string or a TranslationMessage.
   * @returns {string} The translated message.
   */
  getTranslatedMessage(message) {
    if (typeof message === 'string') {
      return VegaInternalTranslation.t(message);
    }
    return VegaInternalTranslation.t(message.key, ...(message.args || []));
  }
}
