import { i18n } from "@lingui/core";
import { I18nProvider } from "@lingui/react";
import React, { type ReactNode } from "react";

// import { messages as deMessages } from "../locales/de-DE/messages";
import { messages as enMessages } from "../locales/en-US/messages";
// import { messages as hiMessages } from "../locales/hi-IN/messages";

export const SUPPORTED_LOCALES = [
	// order as they appear in the language dropdown
	"en-US",
	// "hi-IN",
	// "de-DE",
];
export type SupportedLocale = (typeof SUPPORTED_LOCALES)[number];

export const DEFAULT_LOCALE: SupportedLocale = "en-US";

export const LOCALE_LABEL: { [locale in SupportedLocale]: string } = {
	"en-US": "English",
	"hi-IN": "हिंदी",
	"de-DE": "Deutsch",
};

i18n.load({
	"en-US": enMessages,
	// "hi-HI": hiMessages,
	// "de-DE": deMessages,
});
i18n.activate(DEFAULT_LOCALE);

export const LocalizationProvider = ({ children }: { children: ReactNode }) => {
	return <I18nProvider i18n={i18n}>{children}</I18nProvider>;
};
