import type { TFunction } from "i18next";

export function resolveStampLocale(
  preferredLanguage?: string | null,
): "am" | "en" {
  const normalized = (preferredLanguage ?? "").toLowerCase();
  if (normalized === "am" || normalized.startsWith("am")) return "am";
  if (normalized === "en" || normalized.startsWith("en")) return "en";
  return "en";
}

export function getNoStampsForLanguageMessage(
  locale: "am" | "en",
  t: TFunction,
): string {
  const language =
    locale === "am" ? t("header.amharic") : t("header.english");
  return t("ApprovalPage.noStampsForLanguage", { language });
}
