import { ICONS } from "~/utils/icons";

const i18nIcons = {
  icon_a: ICONS.A,
  icon_b: ICONS.B,
  icon_x: ICONS.X,
  icon_y: ICONS.Y,
  icon_heart: ICONS.HEART,
  icon_happy: ICONS.HAPPY,
  icon_angry: ICONS.ANGRY,
  icon_sad: ICONS.SAD,
  icon_neutral: ICONS.NEUTRAL,
} as const;

export default defineI18nConfig(() => ({
  // resolve icons
  postTranslation: (translated) => {
    if (typeof translated !== "string") return translated;

    let result = translated;
    for (const [key, value] of Object.entries(i18nIcons)) {
      result = result.replaceAll(key, value);
    }

    return result;
  },
}));
