import type { Config } from '@sveltejs/adapter-vercel';
import { loadTranslations } from '$lib/translations';

/** @type {import('@sveltejs/kit').Load} */
export const load = async ({ url }) => {
  const { pathname } = url;

  let initLocale = 'en'; // get from cookie, user session, ...

  console.log(navigator.language);

  if (navigator.language.includes('de')) {
    initLocale = 'de';    
  }
  
  await loadTranslations(initLocale, pathname); // keep this just before the `return`

  return {};
}

export const config: Config = {
	runtime: 'nodejs22.x'
};