import { useSetting } from "./useSettings";

export const VALID_LANGUAGES = ["en", "de"] as const;
export type Language = (typeof VALID_LANGUAGES)[number];

export function useLanguage(): Language {
	const { data } = useSetting("language");
	if (data && VALID_LANGUAGES.includes(data as Language)) {
		return data as Language;
	}
	return "en";
}
