feat: track images with git lfs

This commit is contained in:
2024-03-27 01:51:42 +01:00
parent f0129ecc76
commit 31b24de86c
142 changed files with 5133 additions and 169 deletions

View File

@@ -2,11 +2,18 @@
import { locales, defaultLocale, getLocale } from "astro-i18n-aut";
import { useTranslations } from "../i18n/utils";
const reg = new RegExp(`^\/(${Object.keys(locales).join("|")})\/`);
function translatePath(lang: string) {
const p = Astro.url.pathname.replace(reg, "").replace(/^\//, "");
if (lang === defaultLocale) return `/${p}`;
return `/${lang}/${p}`;
const split = Astro.url.pathname.split("/").filter((s) => s.length);
if (split[0] in locales) {
split.shift();
}
if (lang === defaultLocale) {
return `/${split.join("/")}`;
}
return `/${[lang, ...split].join("/")}`;
}
const locale = getLocale(Astro.url);