aboutsummaryrefslogtreecommitdiffstats
path: root/doc/img/translate_github.png
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-04 09:24:24 -0800
committerAdam Soltys <[email protected]>2024-11-04 09:24:24 -0800
commit19275348996a0d9707f0e849769a9ad90d01ab3d (patch)
tree8d883a162f657d3ecb67c56bb762fc1c922ab970 /doc/img/translate_github.png
parentedecafe4a961f4914b99c1a26463067fcbd2dd6a (diff)
downloadcoinos-ui-19275348996a0d9707f0e849769a9ad90d01ab3d.tar.gz
coinos-ui-19275348996a0d9707f0e849769a9ad90d01ab3d.zip
coinos logo icon
Diffstat (limited to 'doc/img/translate_github.png')
0 files changed, 0 insertions, 0 deletions
re>
13466248 ^





3444b3c0 ^
13466248 ^

3444b3c0 ^
13466248 ^



3444b3c0 ^
e5f37b00 ^
b3653c0a ^
13466248 ^
3444b3c0 ^
13466248 ^

e5f37b00 ^
13466248 ^
1f79c659 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
                                                                                   
 
                                                     
                                      
                                                         
 





                                                                  
 

                                                                     
 



                                                          
 
                                      
 
                                                
 

          
                                 
    
  
import { defaultLocale, loadTranslations, locales } from "$lib/translations/index";

export const load = async ({ cookies, request }) => {
  // Try to get the locale from cookie
  let locale = (cookies.get("lang") || "").toLowerCase();

  // Get user preferred locale
  if (!locale) {
    locale = `${`${request.headers.get("accept-language")}`.match(
      /[a-zA-Z]+?(?=-|_|,|;)/,
    )}`.toLowerCase();
  }

  // Get defined locales
  const supportedLocales = locales.get().map((l) => l.toLowerCase());

  // Use default locale if current locale is not supported
  if (!supportedLocales.includes(locale)) {
    locale = defaultLocale;
  }

  await loadTranslations(locale, "/");

  const theme = cookies.get("theme") || "light";

  return {
    theme,
    i18n: { locale, route: "/" },
  };
};