export const useLocale = ()=>{
  const locale = window.location.pathname.split('/')[1]
  const setLocale = (newLocale: string) => {
    const segments = window.location.pathname.split('/');
    segments[1] = newLocale;
    const newPath = segments.join('/');
    window.history.pushState({}, '', newPath);
    window.location.reload();
  }
  return {
    locale,
    setLocale
  }
}