import { defineNuxtPlugin } from "#app";
import { createI18n } from "vue-i18n";
import { HttpRequestBuilder } from "../../vendor/cel-js/lib/http-builder.js";
export default defineNuxtPlugin({
  name: "shwfed:i18n",
  setup: (nuxt) => {
    const i18n = createI18n({
      locale: navigator?.language,
      legacy: false,
      fallbackWarn: false,
      fallbackLocale: "zh",
      globalInjection: false
    });
    nuxt.vueApp.use(i18n);
    HttpRequestBuilder.setDefaultHeader(
      "Accept-Language",
      () => i18n.global.locale.value
    );
  }
});
