File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
---
2
+ import { LANGUAGES } from ' @/i18n' ;
2
3
// @ts-expect-error not found
3
4
import { base } from ' astro:config/client' ;
4
5
5
- const languages = Object .keys (import .meta .glob (' ../pages/*.astro' )).map (p => p .split (' /' ).at (- 1 )! .replace (' .astro' , ' ' )).sort ();
6
6
const pathname = Astro .url .pathname .replace (import .meta .env .BASE_URL , ' ' );
7
7
const currentLang = pathname .split (' /' )[1 ];
8
+
8
9
---
9
10
<div class =" language-switcher" >
10
- { languages .map ((lang , i ) => (
11
+ { LANGUAGES .map ((lang , i ) => (
11
12
<>
12
13
<a href = { ` ${base as string }/${lang }/ ` } class :list = { { active: lang === currentLang }} >
13
14
{ lang .toUpperCase ()}
14
15
</a >
15
- { i < languages .length - 1 && <span class = " separator" >/</span >}
16
+ { i < LANGUAGES .length - 1 && <span class = " separator" >/</span >}
16
17
</>
17
18
))}
18
19
</div >
You can’t perform that action at this time.
0 commit comments