web


git clone https://radroots.dev/git/web.git
Log | Files | Refs | Submodules | README | LICENSE

+layout.ts (630B)


      1 import { load_translations, locales, translations_loading } from '$lib/utils/i18n';
      2 import { get_locale, handle_err } from '@radroots/apps-lib';
      3 import type { LayoutLoad, LayoutLoadEvent } from './$types';
      4 
      5 export const prerender = true;
      6 export const ssr = false;
      7 export const trailingSlash = 'always';
      8 
      9 export const load: LayoutLoad = async ({ url }: LayoutLoadEvent) => {
     10     try {
     11         const loc = get_locale(locales.get());
     12         await load_translations(loc, url.pathname);
     13         await translations_loading.toPromise();
     14     } catch (e) {
     15         handle_err(e, `(root)load`)
     16     } finally {
     17         return {};
     18     };
     19 };