File tree 10 files changed +31
-28
lines changed
10 files changed +31
-28
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
interface Props {}
3
3
4
- import { getLangFromUrl , useTranslations } from ' ../i18n/utils' ;
4
+ import { useTranslations } from ' ../i18n/utils' ;
5
5
import { Image } from ' astro:assets' ;
6
6
import aux from ' ../../public/aux.svg' ;
7
7
8
- const lang = getLangFromUrl ( Astro .url ) ;
8
+ const { lang } = Astro .params ;
9
9
const translation = useTranslations (lang );
10
10
---
11
11
Original file line number Diff line number Diff line change 1
1
---
2
- import { getLangFromUrl , useTranslations } from ' ../../i18n/utils' ;
2
+ import { useTranslations } from ' ../../i18n/utils' ;
3
3
4
- const lang = getLangFromUrl ( Astro .url ) ;
4
+ const { lang } = Astro .params ;
5
5
const translation = useTranslations (lang );
6
6
---
7
7
Original file line number Diff line number Diff line change 1
1
---
2
- import { getLangFromUrl , useTranslations } from ' ../../i18n/utils' ;
2
+ import { useTranslations } from ' ../../i18n/utils' ;
3
3
import { Image } from ' astro:assets' ;
4
4
import aux from ' ../../../public/aux.svg' ;
5
5
6
- const lang = getLangFromUrl ( Astro .url ) ;
6
+ const { lang } = Astro .params ;
7
7
const translation = useTranslations (lang );
8
8
---
9
9
Original file line number Diff line number Diff line change 1
1
---
2
- import { getLangFromUrl , useTranslations } from ' ../../i18n/utils' ;
2
+ import { useTranslations } from ' ../../i18n/utils' ;
3
3
4
- const lang = getLangFromUrl ( Astro .url ) ;
4
+ const { lang } = Astro .params ;
5
5
const translation = useTranslations (lang );
6
6
---
7
7
Original file line number Diff line number Diff line change 1
1
---
2
- import { getLangFromUrl , useTranslations } from ' ../../i18n/utils' ;
2
+ import { useTranslations } from ' ../../i18n/utils' ;
3
3
4
- const lang = getLangFromUrl ( Astro .url ) ;
4
+ const { lang } = Astro .params ;
5
5
const translation = useTranslations (lang );
6
6
---
7
7
Original file line number Diff line number Diff line change 1
1
import { ui , defaultLang } from './ui' ;
2
2
3
- export function getLangFromUrl ( url : URL ) {
4
- const [ , lang ] = url . pathname . split ( '/' ) ;
5
- if ( lang in ui ) return lang as keyof typeof ui ;
6
- return defaultLang ;
7
- }
8
-
9
3
export function useTranslations ( lang : keyof typeof ui ) {
10
4
return function t ( key : keyof typeof ui [ typeof defaultLang ] ) {
11
5
return ui [ lang ] [ key ] || ui [ defaultLang ] [ key ] ;
Original file line number Diff line number Diff line change 1
1
---
2
- import { getLangFromUrl } from ' ../i18n/utils' ;
3
2
import Header from " ../components/Header.astro" ;
4
3
5
4
interface Props {
6
5
title: string ;
7
6
}
8
7
9
8
const { title } = Astro .props ;
10
-
11
- const lang = getLangFromUrl (Astro .url );
9
+ const { lang } = Astro .params ;
12
10
---
13
11
14
12
<!doctype html >
Original file line number Diff line number Diff line change
1
+ ---
2
+ import { languages } from " ../../i18n/ui" ;
3
+ import Layout from " ../../layouts/Layout.astro" ;
4
+ import Home from " ../../components/home/Home.astro" ;
5
+
6
+ export async function getStaticPaths() {
7
+ return Object .keys (languages ).map ((name ) => (
8
+ { params : { lang : name } }
9
+ ))
10
+ }
11
+ ---
12
+
13
+ <Layout title =" auxolotl.org" >
14
+ <Home />
15
+ </Layout >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- <meta http-equiv =" refresh" content =" 0;url=/en/" />
1
+ ---
2
+ import { defaultLang } from ' ../i18n/ui' ;
3
+ ---
4
+
5
+ <meta http-equiv =" refresh" content =`0;url=/${defaultLang }/` />
You can’t perform that action at this time.
0 commit comments