Skip to content

Commit 7889eb7

Browse files
committed
feat(LanguagePicker): use LANGUAGES
1 parent 9a27cc7 commit 7889eb7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

2025/src/components/LanguagePicker.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
---
2+
import { LANGUAGES } from '@/i18n';
23
// @ts-expect-error not found
34
import { base } from 'astro:config/client';
45
5-
const languages = Object.keys(import.meta.glob('../pages/*.astro')).map(p => p.split('/').at(-1)!.replace('.astro', '')).sort();
66
const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, '');
77
const currentLang = pathname.split('/')[1];
8+
89
---
910
<div class="language-switcher">
10-
{languages.map((lang, i) => (
11+
{LANGUAGES.map((lang, i) => (
1112
<>
1213
<a href={`${base as string}/${lang}/`} class:list={{ active: lang === currentLang }}>
1314
{lang.toUpperCase()}
1415
</a>
15-
{i < languages.length - 1 && <span class="separator">/</span>}
16+
{i < LANGUAGES.length - 1 && <span class="separator">/</span>}
1617
</>
1718
))}
1819
</div>

0 commit comments

Comments
 (0)