feat: add some stuff
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import { locales, defaultLocale, getLocale } from "astro-i18n-aut";
|
||||
import { locales, defaultLocale } from "astro-i18n-aut";
|
||||
import { useTranslations } from "../i18n/utils";
|
||||
|
||||
function translatePath(lang: string) {
|
||||
@@ -16,15 +16,16 @@ function translatePath(lang: string) {
|
||||
return `/${[lang, ...split].join("/")}`;
|
||||
}
|
||||
|
||||
const locale = getLocale(Astro.url);
|
||||
const t = useTranslations(locale);
|
||||
const t = useTranslations(Astro);
|
||||
---
|
||||
|
||||
<ul>
|
||||
{
|
||||
Object.entries(locales).map(([lang, label]) => (
|
||||
<li>
|
||||
<a href={translatePath(lang)}>{t(label as "de")}</a>
|
||||
<a href={translatePath(lang)} data-astro-prefetch>
|
||||
{t(label as "de")}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user