import { StorageKeys} from "../globalConstants";

export function getInitialLocale() {
  const storedLocale = localStorage.getItem(StorageKeys.Locale);
  if (!storedLocale) {
    const browserLocale = ['zh', 'zh-CN'].includes(navigator.language) // FIXME locale
      ? 'zh'
      : 'en';
    localStorage.setItem(StorageKeys.Locale, browserLocale);
    return browserLocale;
  } else {
    return storedLocale;
  }
}
