update
Some checks failed
deploy / deploy (push) Has been cancelled

This commit is contained in:
toom1996
2026-08-19 20:42:42 +08:00
parent e1552feb8c
commit 975c55feb2
8 changed files with 568 additions and 55 deletions

View File

@ -1,4 +1,4 @@
import { getLocaleByPath } from 'astro:i18n';
import { getLocaleByPath, getRelativeLocaleUrl } from 'astro:i18n';
import { DEFAULT_LOCALE, LOCALES, type Locale } from '@/i18n/config';
import { translate } from '@/i18n/dictionary';
@ -38,7 +38,7 @@ export function useTranslations(locale: Locale) {
export function getI18n(Astro: { currentLocale?: string | undefined }) {
const locale = (Astro.currentLocale as Locale) ?? DEFAULT_LOCALE;
const { t } = useTranslations(locale);
return { locale, t };
return { locale, t, getRelativeLocaleUrl };
}
export { LOCALES, DEFAULT_LOCALE };