import { readdirSync } from "fs";
import { join } from "path";

export const LOCALES_PATH = join("locales");
export const LOCAL_LOCALES_PATH = join("public", LOCALES_PATH);
export const DEFAULT_LANGUAGE = "en";

export default {
  locales: readdirSync(LOCAL_LOCALES_PATH)
    .filter((file) => file.endsWith(".json"))
    .map((locale) => locale.replace(".json", "")),
  defaultLocale: DEFAULT_LANGUAGE,
  fallbackLng: DEFAULT_LANGUAGE,
  react: {
    useSuspense: false,
  },
  extract: {
    input: "src/**/*.{js,jsx,ts,tsx}",
    output: join(LOCAL_LOCALES_PATH, "{{language}}.json"),
  },
};
