import { LOCALE_MAP } from 'src/constants/locale';
import { MeUser } from 'src/types/user';

export const getCurrentLocale = (user: MeUser | null): Locale => {
  if (!user?.language) return LOCALE_MAP.es;

  return (
    LOCALE_MAP[user.language.toLowerCase() as keyof typeof LOCALE_MAP] ||
    LOCALE_MAP.es
  );
};
