<script setup>
import { defineAsyncComponent } from 'vue'

const size375 = defineAsyncComponent(() => import("@/views/news/size375/index.vue"));
const size768 = defineAsyncComponent(() => import("@/views/news/size768/index.vue"));
const size1440 = defineAsyncComponent(() => import("@/views/news/size1440/index.vue"));
const size1920 = defineAsyncComponent(() => import("@/views/news/size1920/index.vue"));

const { viewComponent, componentKey } = useViewSelector({
  size375,
  size768,
  size1440,
  size1920,
});

const bg = usePageBackground("bg-news.png");

definePageMeta({
  layout: "default",
});

// 国际化支持
const { locale } = useI18n();

const seoTitles = {
  zh: "最新新闻与动态 | FiEE",
  en: "Latest News & Updates | FiEE",
  ja: "最新ニュースと更新情報 | FiEE",
  "zh-TW": "最新新聞與動態 | FiEE",
};

const seoDescriptions = {
  zh: "获取FiEE的最新新闻稿、公司新闻和活动更新。",
  en: "Stay updated with the latest press releases, corporate news, and event updates from FiEE.",
  ja: "FiEEの最新プレスリリース、企業ニュース、イベント更新情報をご覧ください。",
  "zh-TW": "獲取FiEE的最新新聞稿、公司新聞和活動更新。",
};

const currentLocale = locale.value;

useSeoMeta({
  title: seoTitles[currentLocale] || seoTitles.en,
  description: seoDescriptions[currentLocale] || seoDescriptions.en,
  ogTitle: seoTitles[currentLocale] || seoTitles.en,
});

provide('pageBg', bg);
</script>

<template>
  <component :is="viewComponent" :key="componentKey" />
</template>
